-----------------------------------------------------------------------------
| 428 | |
| 429 | //----------------------------------------------------------------------------- |
| 430 | UTF16 oneUTF32toUTF16(const UTF32 codepoint) |
| 431 | { |
| 432 | // found a codepoint outside the encodable UTF-16 range! |
| 433 | // or, found an illegal codepoint! |
| 434 | if(codepoint >= 0x10FFFF || isSurrogateRange(codepoint)) |
| 435 | return kReplacementChar; |
| 436 | |
| 437 | // these are legal, we just don't want to deal with them. |
| 438 | if(isAboveBMP(codepoint)) |
| 439 | return kReplacementChar; |
| 440 | |
| 441 | return (UTF16)codepoint; |
| 442 | } |
| 443 | |
| 444 | //----------------------------------------------------------------------------- |
| 445 | U32 oneUTF32toUTF8(const UTF32 codepoint, UTF8 *threeByteCodeunitBuf) |
no test coverage detected