MCPcopy Create free account
hub / github.com/Moddable-OpenSource/moddable / fxCESU8Decode

Function fxCESU8Decode

xs/sources/xsCommon.c:1084–1099  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1082}
1083
1084txString fxCESU8Decode(txString string, txInteger* character)
1085{
1086 txInteger result;
1087 string = fxUTF8Decode(string, &result);
1088 if ((0x0000D800 <= result) && (result <= 0x0000DBFF)) {
1089 txString former = string;
1090 txInteger surrogate;
1091 string = fxUTF8Decode(former, &surrogate);
1092 if ((0x0000DC00 <= surrogate) && (surrogate <= 0x0000DFFF))
1093 result = 0x00010000 + ((result & 0x000003FF) << 10) + (surrogate & 0x000003FF);
1094 else
1095 string = former;
1096 }
1097 *character = result;
1098 return string;
1099}
1100
1101txString fxCESU8Encode(txString string, txInteger character)
1102{

Callers 2

fxEchoStringFunction · 0.85
fxCESU8CompareFunction · 0.85

Calls 1

fxUTF8DecodeFunction · 0.85

Tested by

no test coverage detected