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

Native unicode not working in 3.x.x with toShort() in php lib #569

Closed mikhailter closed 6 years ago

mikhailter commented 6 years ago

Hi,

i'v found that this code is working on 2.2.7, but not on any of 3.x.x:

require('include/emojione-3.1.2/lib/php/autoload.php');
$client = new Emojione\Client(new Emojione\Ruleset());
$txt = $client->toShort($_POST['txt']);

The final output is the same as without any conversions, but it's perfectly works on 2.2.7. (I have full utf-8 web stack).

I checked all changes in upgrade/install but didn't find any encoding changes in ./lib/php/src.

mikhailter commented 6 years ago

Hmm, after some research, i'v found a strange thing in public function toShortCallback($m) in Client.php:

https://github.com/emojione/emojione/blob/d56ef20055c49961f14867ef7ce0aec15ced2f7b/lib/php/src/Client.php#L426

I really don't know why it's necessary to use strtoupper() here, because getUnicodeReplace() returns lowercase array for unicode replacement.

I've temporary removed strtoupper() and it's works well. Please check this point.