(codePoint)
| 6387 | } |
| 6388 | |
| 6389 | function encodeCodePoint(codePoint) { |
| 6390 | if ((codePoint & 0xFFFFFF80) == 0) { // 1-byte sequence |
| 6391 | return stringFromCharCode(codePoint); |
| 6392 | } |
| 6393 | var symbol = ''; |
| 6394 | if ((codePoint & 0xFFFFF800) == 0) { // 2-byte sequence |
| 6395 | symbol = stringFromCharCode(((codePoint >> 6) & 0x1F) | 0xC0); |
| 6396 | } |
| 6397 | else if ((codePoint & 0xFFFF0000) == 0) { // 3-byte sequence |
| 6398 | symbol = stringFromCharCode(((codePoint >> 12) & 0x0F) | 0xE0); |
| 6399 | symbol += createByte(codePoint, 6); |
| 6400 | } |
| 6401 | else if ((codePoint & 0xFFE00000) == 0) { // 4-byte sequence |
| 6402 | symbol = stringFromCharCode(((codePoint >> 18) & 0x07) | 0xF0); |
| 6403 | symbol += createByte(codePoint, 12); |
| 6404 | symbol += createByte(codePoint, 6); |
| 6405 | } |
| 6406 | symbol += stringFromCharCode((codePoint & 0x3F) | 0x80); |
| 6407 | return symbol; |
| 6408 | } |
| 6409 | |
| 6410 | function wtf8encode(string) { |
| 6411 | var codePoints = ucs2decode(string); |
no test coverage detected