How Unicode-encoded emoji is displayed on the front-end

Source: Internet
Author: User

Call this method

function Findsurrogatepair (point) {  //  assumes point > 0xFFFF  var offset = Point -0x10000,      = 0xd800 + (offset >>),      = 0xdc00 + (offset & 0x3ff);   return [Lead.tostring (+), trail.tostring (+)];}

Example: The Unicode encoding of a emoji is u+1f339, the previous u+ is replaced with 0x, that is, u+1f339-->0x1f339, to the above function

Findsurrogatepair (0x1f600)

You will then receive an array


The two items in the array are stitched together into: [' \ud83d\ude00 '], and the resulting results can be displayed directly on the front end.

Original link

How Unicode-encoded emoji is displayed on the front-end

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.