joypixels / emojione

[Archived] The world's largest independent emoji font. Maintained at https://github.com/joypixels/emoji-toolkit.
https://www.joypixels.com
Other
4.46k stars 535 forks source link

[php] `#` & `*` are recognized as emojis while they should not #599

Closed Abdelhady closed 6 years ago

Abdelhady commented 6 years ago

I'm using the following code to translate emojis to their shortnames:

function getShortText($text) {
    $emojiClient = new \Emojione\Client(new \Emojione\Ruleset());
    return $emojiClient->toShort($text);
}

using your latest version 3.1.5

now if I used this function like: getShortText("Hello #world from Mr.*")

I get this response Hello :pound_symbol:world from Mr.:asterisk_symbol: while I should get the following text instead: Hello #world from Mr.*

& I read the Client() & Ruleset() sourcecodes & I can't find anything to disable this weird behavior !!

ShobhanaMarkeshan commented 6 years ago

I'm using the following code to translate emojis to their images:

function convert() {
    var input = document.getElementById('inputText').value;
    var output = emojione.unicodeToImage(input);
    document.getElementById('outputText').innerHTML = output;
  }

using your latest version 3.1.6

(https://demos.emojione.com/latest/jsunicodetoimage.html)

even i am facing the same problem.. screenshot-2018-7-4 unicodetoimage str - javascript - emojione labs

can some one help out.. Thank you in advance..

Benxter83 commented 6 years ago

Yeah, we have the same problem. Apparently with minor release 3.1.5 this was introduced. For now we downgraded to 3.1.4 which doesn't have the problem. All digits are also affected btw.

xosofox commented 6 years ago

Same issue on our end, downgrade to 3.1.4 helps for the moment

Benxter83 commented 6 years ago

@EmojiOne I understand that this "issue" is actually an feature but then you should have introduced this into a major/minor version and not as a patch version because this is now a breaking change...

ShobhanaMarkeshan commented 6 years ago

If i downgrade from 3.1.6 to 3.1.4. I am facing the below problem. Any solution will be appreciated. emojierr

ankero commented 6 years ago

If you have been using the toShort() function with markdown, I highly recommend doing a manual check what else this function has broken. For us this broke our whole markdown, mentions, links, everything that had numbers and special characters, and of course in web app + in mobile app.

We are currently doing a migration function to revert every character this library has converted in our DB since the bug was introduced. Here's a short snippet for anyone who needs to do some quick replacing of the most crucial markdown characters in Javascript:

   var convertEmojioneBug = [
    [":digit_one:",1],
    [":digit_two:",2],
    [":digit_three:",3],
    [":digit_four:",4],
    [":digit_five:",5],
    [":digit_six:",6],
    [":digit_seven:",7],
    [":digit_eight:",8],
    [":digit_nine:",9],
    [":digit_zero:",0],
    [":asterisk_symbol:","*"],
    [":pound_symbol:","#"] // And yes, this is correct... :pound_symbol: = #, because why not
  ]

    function _fixEmojioneBug(content) {
      _.forEach(convertEmojioneBug, function(fix) {
        var regex = new RegExp(fix[0], 'g');
        content = content.replace(regex,fix[1]);
      })
      return content;
    }
caseyahenson commented 6 years ago

These bugs are repaired in today's 3.1.7 release. Our apologies for the trouble this oversight caused.