Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

crashing with emoji #7

Open
wasawi opened this issue Feb 19, 2014 · 1 comment
Open

crashing with emoji #7

wasawi opened this issue Feb 19, 2014 · 1 comment

Comments

@wasawi
Copy link

wasawi commented Feb 19, 2014

Hi James, its Jordi from Japan,

I'm using this addon togheter with Carles, there has been another related issue here:
rezaali/ofxUI#172

Well, we are receiving UTF-8 strings from the web and I noticed that ofxFTGL is crashing when receiving emojis:

str = "音"; // this does not crash
str = "\360\237\230\215"; // this crashes

Sorry,github doesnt let me paste the emoji either ... "Body contains unicode characters above 0xffff"

I'm looking for a way to findAndDestroy emojis :) I'm almost there but perhaps you know a smarter way to fix that. To me, it seems that FTGL crashes when receives 4 byte symbols. but I haven't completely tested out. I can find those and delete them in my code but probably the best it would be to have it fixed in the addon.

Any thoughts?
Cheers!
j

@wasawi
Copy link
Author

wasawi commented Feb 19, 2014

this code will kill emojis in a rude way.. but there must be a better way to do the job I guess.

string ofApp::parseString(string s){

    string returnString = "";
    int l = s.length();
    int i;

    // for each byte
    for (i = 0; i < l; ++i) {
        char mychar = s[i];
        string binary = ofToBinary(mychar);
        binary =  binary.substr(0,4);
        if (binary == "1111"){
            i+=3;       //jump to next char
            cout << "Found Emoji, killing... " << endl;
        }else{
            returnString += mychar;
        }
    }
    return returnString;
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant