Open main menu
Home
Random
Recent changes
Special pages
Community portal
Preferences
About Wikipedia
Disclaimers
Incubator escapee wiki
Search
User menu
Talk
Dark mode
Contributions
Create account
Log in
Editing
UTF-16
(section)
Warning:
You are not logged in. Your IP address will be publicly visible if you make any edits. If you
log in
or
create an account
, your edits will be attributed to your username, along with other benefits.
Anti-spam check. Do
not
fill this in!
=== Examples === To encode U+10437 (π·) to UTF-16: * Subtract 0x10000 from the code point, leaving 0x0437. * For the high surrogate, shift right by 10 (divide by 0x400), then add 0xD800, resulting in 0x0001 + 0xD800 = 0xD801. * For the low surrogate, take the low 10 bits (remainder of dividing by 0x400), then add 0xDC00, resulting in 0x0037 + 0xDC00 = 0xDC37. To decode U+10437 (π·) from UTF-16: * Take the high surrogate (0xD801) and subtract 0xD800, then multiply by 0x400, resulting in 0x0001 Γ 0x400 = 0x0400. * Take the low surrogate (0xDC37) and subtract 0xDC00, resulting in 0x37. * Add these two results together (0x0437), and finally add 0x10000 to get the final code point, 0x10437. The following table summarizes this conversion, as well as others. The colors indicate how bits from the code point are distributed among the UTF-16 bytes. Additional bits added by the UTF-16 encoding process are shown in black. {| class="wikitable" |- !colspan=2|Character ! Binary code point ! Binary UTF-16 ! UTF-16 hex<br />code units ! UTF-16BE<br />hex bytes ! UTF-16LE<br />hex bytes |- |[[$]] || <code>U+0024</code> |align=right|<code>{{Font color|#2196f3|0000 0000 0010 0100}}</code> |align=right|<code>{{Font color|#2196f3|0000 0000 0010 0100}}</code> |align=right|<code>{{Font color|#2196f3|0024}}</code> |align=right|<code>{{Font color|#2196f3|00 24}}</code> |align=right|<code>{{Font color|#2196f3|24 00}}</code> |- |[[Euro sign|β¬]] || <code>U+20AC</code> |align=right|<code>{{Font color|#2196f3|0010 0000 1010 1100}}</code> |align=right|<code>{{Font color|#2196f3|0010 0000 1010 1100}}</code> |align=right|<code>{{Font color|#2196f3|20AC}}</code> |align=right|<code>{{Font color|#2196f3|20 AC}}</code> |align=right|<code>{{Font color|#2196f3|AC 20}}</code> |- |[[π·]] || <code>U+10437</code> |align=right|<code>{{Font color|#e91e63|0001 0000 01}}{{Font color|#2196f3|00 0011 0111}}</code> |align=right|<code>1101 10{{Font color|#e91e63|00 0000 0001}} 1101 11{{Font color|#2196f3|00 0011 0111}}</code> |align=right|<code>{{Font color|#e91e63|D801}} {{Font color|#2196f3|DC37}}</code> |align=right|<code>{{Font color|#e91e63|D8 01}} {{Font color|#2196f3|DC 37}}</code> |align=right|<code>{{Font color|#e91e63|01 D8}} {{Font color|#2196f3|37 DC}}</code> |- |[[wikt:π€’|π€’]] || <code>U+24B62</code> |align=right|<code>{{Font color|#e91e63|0010 0100 10}}{{Font color|#2196f3|11 0110 0010}}</code> |align=right|<code>1101 10{{Font color|#e91e63|00 0101 0010}} 1101 11{{Font color|#2196f3|11 0110 0010}}</code> |align=right|<code>{{Font color|#e91e63|D852}} {{Font color|#2196f3|DF62}}</code> |align=right|<code>{{Font color|#e91e63|D8 52}} {{Font color|#2196f3|DF 62}}</code> |align=right|<code>{{Font color|#e91e63|52 D8}} {{Font color|#2196f3|62 DF}}</code> |} {{anchor|UTF-16LE|UTF-16BE}}
Edit summary
(Briefly describe your changes)
By publishing changes, you agree to the
Terms of Use
, and you irrevocably agree to release your contribution under the
CC BY-SA 4.0 License
and the
GFDL
. You agree that a hyperlink or URL is sufficient attribution under the Creative Commons license.
Cancel
Editing help
(opens in new window)