|
@@ -192,6 +192,9 @@ function UTF8ToUTF16(const P: PChar; ByteCnt: SizeUInt): UnicodeString; overload
|
|
function UTF16ToUTF8(const S: UnicodeString): AnsiString; overload; inline;
|
|
function UTF16ToUTF8(const S: UnicodeString): AnsiString; overload; inline;
|
|
function UTF16ToUTF8(const P: PWideChar; WideCnt: SizeUInt): AnsiString; overload;
|
|
function UTF16ToUTF8(const P: PWideChar; WideCnt: SizeUInt): AnsiString; overload;
|
|
|
|
|
|
|
|
+function UTF8CharAtBytePos(const s: Ansistring; const BytePos: PtrInt; out aChar: AnsiString): PtrInt;
|
|
|
|
+
|
|
|
|
+
|
|
var
|
|
var
|
|
FPUpChars: array[char] of char;
|
|
FPUpChars: array[char] of char;
|
|
|
|
|
|
@@ -4052,6 +4055,23 @@ begin
|
|
Result := '';
|
|
Result := '';
|
|
end;
|
|
end;
|
|
|
|
|
|
|
|
+function UTF8CharAtBytePos(const s: Ansistring; const BytePos: PtrInt; out aChar: AnsiString): PtrInt;
|
|
|
|
+var
|
|
|
|
+ lCharLen: Integer;
|
|
|
|
+begin
|
|
|
|
+ if BytePos > 0 then
|
|
|
|
+ begin
|
|
|
|
+ lCharLen := UTF8CodepointSize(@s[BytePos]);
|
|
|
|
+ aChar := Copy(s, BytePos, lCharLen);
|
|
|
|
+ Result := BytePos + lCharLen;
|
|
|
|
+ end else
|
|
|
|
+ begin
|
|
|
|
+ aChar := '';
|
|
|
|
+ Result := 1;
|
|
|
|
+ end;
|
|
|
|
+end;
|
|
|
|
+
|
|
|
|
+
|
|
procedure InitFPUpchars;
|
|
procedure InitFPUpchars;
|
|
var
|
|
var
|
|
c: Char;
|
|
c: Char;
|