The problem of emoji and JSON in OBJECT-C

Source: Internet
Author: User

Encounter a problem, to save iOS keyboard output emoji expression to MySQL, I know that with Blob+utf8 can be saved. But now my watch is too big to change the type. So I want to match the emoji expression, replace it, then save it.
However, iOS keyboard input emoji expression, not the standard 0xe001 - 0xe537 this, but changed.
For example: The first laugh expression, the standard emoji Unicode is 0xe415 and the iOS keyboard output is 0xd83dxde04 two bits.
I use Preg_match () to make a match

Preg_match ($matches); Var_dump ($matches); 

Print out is a NULL

Ask the gods, how can you match this emoji ah ...

Add: I use Preg_match ('/[\x{0000}-\x{ffff}]/u ', $str _with_emoji_emotion, $matches); Go to match is not matched to ... I suspect it's a question of the emoji, and continue to study ... Continue solving ...

Supplement 2: Today's done, did the Bin2Hex transcoding http://jiajun.org/g/emoji_encoder.php

It's done today, Bin2Hex's transcoding http://jiajun.org/g/emoji_encoder.php.

In fact, there is an open source conversion program.
http://code.iamcal.com/php/emoji/
Https://github.com/iamcal/php-emoji

Give it a try.

Preg_match ($matches);

The problem of emoji and JSON in OBJECT-C

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.