TCPDF_FONTS::arrUTF8ToUTF16BE( $unicode, $setbom = false )
Converts array of UTF-8 characters to UTF16-BE string.
Based on: http://www.faqs.org/rfcs/rfc2781.html <pre>
Encoding UTF-16:
Description Description
Encoding of a single character from an ISO 10646 character value to UTF-16 proceeds as follows. Let U be the character number, no greater than 0x10FFFF.
1) If U < 0x10000, encode U as a 16-bit unsigned integer and terminate.
2) Let U’ = U – 0x10000. Because U is less than or equal to 0x10FFFF, U’ must be less than or equal to 0xFFFFF. That is, U’ can be represented in 20 bits.
3) Initialize two 16-bit unsigned integers, W1 and W2, to 0xD800 and 0xDC00, respectively. These integers each have 10 bits free to encode the character value, for a total of 20 bits.
4) Assign the 10 high-order bits of the 20-bit U’ to the 10 low-order bits of W1 and the 10 low-order bits of U’ to the 10 low-order bits of W2. Terminate.
Graphically, steps 2 through 4 look like: U’ = yyyyyyyyyyxxxxxxxxxx W1 = 110110yyyyyyyyyy W2 = 110111xxxxxxxxxx
Parameters Parameters
- $unicode
-
(Required) (array) array containing UTF-8 unicode values
- $setbom
-
(Optional) (boolean) if true set the Byte Order Mark (BOM = 0xFEFF)
Default value: false
Return Return
(string)
Source Source
File: includes/lib/tcpdf/include/tcpdf_fonts.php
Changelog Changelog
Version | Description |
---|---|
2.1.000 | Introduced. |