| 990 | } |
| 991 | |
| 992 | txString fxUTF8Decode(txString string, txInteger* character) |
| 993 | { |
| 994 | txU1* p = (txU1*)string; |
| 995 | txU4 c = c_read8(p++); |
| 996 | if (c) { |
| 997 | if (c & 0x80) { |
| 998 | const txUTF8Sequence *sequence; |
| 999 | txS4 size; |
| 1000 | for (sequence = gxUTF8Sequences; sequence->size; sequence++) { |
| 1001 | if ((c & sequence->cmask) == sequence->cval) |
| 1002 | break; |
| 1003 | } |
| 1004 | size = sequence->size - 1; |
| 1005 | while (size > 0) { |
| 1006 | size--; |
| 1007 | c = (c << 6) | (c_read8(p++) & 0x3F); |
| 1008 | } |
| 1009 | c &= sequence->lmask; |
| 1010 | } |
| 1011 | *character = (txInteger)c; |
| 1012 | return (txString)p; |
| 1013 | } |
| 1014 | *character = C_EOF; |
| 1015 | return (txString)p; |
| 1016 | } |
| 1017 | |
| 1018 | txString fxUTF8Encode(txString string, txInteger character) |
| 1019 | { |
no outgoing calls
no test coverage detected