How to convert old emoji encoding to latest encoding in iOS5?

Unfortunately, after iOS5 was finally released, I received a message from my users that they cannot log in.

Since the names have an emoji character, and the apple has changed the emoji encoding.

so the username contains an old version of emoji, how can I convert them to a new encoding?

thanks!

be specific: one emoji character is "tiger", it is "\ U0001f42f" in iOS5, but "\ ue050" in an earlier version of iOS.

+6
source share
2 answers

iOS 5 and OS X 10.7 (Lion) use standard unified Unicode 6.0 code codes for emoji.

iOS 4 on SoftBank iPhones used a set of unofficial code points in the Unicode private area of ​​use and therefore is not compatible with other systems. To convert from this format to the corresponding Unicode 6.0 characters, you will need to run a large search table from the Softbank to Unified code for all your current data and all new form data as they are submitted. You can also normalize Unicode at this point so that, for example, the letters of the full width match the regular ASCII letters.

See, for example, this table from the library that performs the tasks of transforming graphical objects for PHP.

Emoji in usernames? enter image description here

+1
source

I had the same problem after digging for hours and finally finding this answer that works for me

If you use rails as your server, that’s all you need to do. No need to do anything in ios / xcode, just pass the NSString without using any UTF8 / 16 encoding files on the server.

Postegre saves the code correctly, it's just when you send the json response back to your ios client, assuming you are rendering json: @message, the json encoding problem has problems.

you can check if you have a problem with json coding in the rails console by performing the simplicity of the test in the console test = {"smiley" => "u {1f604}"} test.to_json

if it prints "{\" smiley \ ": \" \ uf604 \ "}" (note that 1 is lost), then you have this problem. and the fix from the link will fix it.

+2
source

Source: https://habr.com/ru/post/899845/


All Articles