UTF-16

UTF-16 (16-bit Unicode Transformation Format) adalah suatu pengkodean karakter Unicode yang mampu mengkodekan 1,112,064[1] angka (disebut code point) dalam jangkauan kode Unicode dari 0 sampai 0x10FFFF. Pengkodean ini adalah sebuah "variable-width encoding" karena code point itu dikodekan dengan satu atau dua code units 16-bit .

Universal Character Set UCS-2 (2-byte) mirip dengan pengkodean karakter yang sekarang digantikan oleh UTF-16 versi 2.0 sebagai standar Unicode pada bulan Juli 1996.[2] Menghasilkan format dengan panjang tetap (fixed-length format) hanya menggunakan code point sebagai unit kode 16-bit dan membuahkan hasil yang tepat sama dengan UTF-16 untuk 97% (63.488; bukan 65.536) dari seluruh code point dalam jangkauan 0-0xFFFF, termasuk semua karakter yang telah diberi nilai saat itu.

UTF-16 secara resmi didefinisikan dalam Annex Q dari standar internasional ISO/IEC 10646.[3] Juga disebut sebagai "The Unicode Standard" versi 2.0 atau lebih tinggi, serta dalam IETF's RFC 2781.

Contoh

code point glyph* character UTF-16 code units (hex) UTF-16BE code units (hex) UTF-16LE code units (hex)
U+007A z LATIN SMALL LETTER Z 007A 00, 7A 7A, 00
U+6C34 CJK UNIFIED IDEOGRAPH-6C34 (water) 6C34 6C, 34 34, 6C
U+10000 𐀀 LINEAR B SYLLABLE B008 A (first non-BMP code point) D800, DC00 D8, 00, DC, 00 00, D8, 00, DC
U+1D11E 𝄞 MUSICAL SYMBOL G CLEF D834, DD1E D8, 34, DD, 1E 34, D8, 1E, DD
U+10FFFD 􏿽 PRIVATE USE CHARACTER-10FFFD (last Unicode code point) DBFF, DFFD DB, FF, DF, FD FF, DB, FD, DF

* Appropriate font and software are required to see the correct glyphs.

Contoh prosedur pengkodean UTF-16

Karakter pada code point U+64321 (hexadecimal) akan dikodekan dalam UTF-16. Karena di atas U+FFFF, harus dikodekan dengan surrogate pair, sebagai berikut:

v  = 0x64321
v′ = v - 0x10000
   = 0x54321
   = 0101 0100 0011 0010 0001
vh = v′ >> 10
   = 01 0101 0000 // higher 10 bits of v′
vl = v′ & 0x3FF
   = 11 0010 0001 // lower  10 bits of v′
w1 = 0xD800 + vh
   = 1101 1000 0000 0000
   +        01 0101 0000
   = 1101 1001 0101 0000
   = 0xD950 // first code unit of UTF-16 encoding
w2 = 0xDC00 + vl
   = 1101 1100 0000 0000
   +        11 0010 0001
   = 1101 1111 0010 0001
   = 0xDF21 // second code unit of UTF-16 encoding

Lihat pula

Referensi

  1. ^ , di mana adalah BMP, adalah interval U+D800–U+DFFF, dan adalah level (plane) tertinggi.
  2. ^ "Questions about encoding forms". Diakses tanggal 12 November 2010.
  3. ^ ISO/IEC 10646-1:2000(E), pp. 890-892; ISO/IEC 10646:2003(E), pp. 1364-1366; ISO/IEC 10646:2012(E) Final Committee Draft (FCD), p. 2208; The FCD contains a reference to clauses 9 and 10, pp. 15-17.

Pranala luar

Templat:Unicode navigation Templat:Character encoding

Content Disclaimer

Informasi ini disarikan dari Wikipedia dan disajikan kembali untuk tujuan edukasi. Konten tersedia di bawah lisensi CC BY-SA 3.0. Kami tidak bertanggung jawab atas ketidakakuratan data yang bersumber dari kontribusi publik tersebut.

  1. The information displayed on this website is sourced in part or in whole from Wikipedia and has been adapted for the purpose of restating it. We strive to provide accurate and relevant information, however:
  2. There is no guarantee of absolute accuracy. Wikipedia is an open, collaborative project that can be edited by anyone, so information is subject to change.
  3. It is not intended to constitute professional advice. The content displayed is for informational and educational purposes only. For important decisions (e.g., medical, legal, or financial), please consult a professional.
  4. Content copyright. Wikipedia is licensed under the Creative Commons Attribution-ShareAlike License (CC BY-SA). This means that content may be reused with appropriate attribution and shared under a similar license.
  5. Responsible use. Any risk arising from the use of information from this website is entirely the responsibility of the user.