jquery .text() and unicode

Javascript internally only supports UTF-16.

Because this is an extended 32-bit UTF character (not in the “Basic Multilingual Plane”) you need to insert the “UTF-16 surrogate pair”, which is helpfully provided on the same page that you linked to:

0xD83D 0xDD13

i.e.

$('#myId').text('\ud83d\udd13');

More details can be found in RFC 4627, which is strictly speaking the format for JSON.

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)