mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-04-08 02:27:56 +02:00
Try to implement UnicodeFromLocaleChars for java
This commit is contained in:
parent
f7d6201946
commit
5a7d5367d2
@ -1047,6 +1047,8 @@ function StringToWideChar(const Src : RawByteString;Dest : PWideChar;DestSize :
|
||||
end;
|
||||
{$endif FPC_HAS_STRING_LEN_TO_WIDECHAR}
|
||||
|
||||
{$ifndef FPC_HAS_UNICODEFROMLOCALECHARS}
|
||||
{$define FPC_HAS_UNICODEFROMLOCALECHARS}
|
||||
function UnicodeFromLocaleChars(CodePage, Flags: Cardinal; LocaleStr: PAnsiChar;
|
||||
LocaleStrLen: Integer; UnicodeStr: PWideChar; UnicodeStrLen: Integer): Integer; overload;
|
||||
|
||||
@ -1067,6 +1069,7 @@ begin
|
||||
// Return length
|
||||
result:=len;
|
||||
end;
|
||||
{$endif ndef FPC_HAS_UNICODEFROMLOCALECHARS}
|
||||
|
||||
function UnicodeFromLocaleChars(const LocaleName: AnsiString; Flags: Cardinal;
|
||||
LocaleStr: PAnsiChar; LocaleStrLen: Integer; UnicodeStr: PWideChar;
|
||||
|
@ -624,6 +624,28 @@ function StringToWideChar(const Src : RawByteString;Dest : PWideChar;DestSize :
|
||||
result:=Dest;
|
||||
end;
|
||||
|
||||
{$define FPC_HAS_UNICODEFROMLOCALECHARS}
|
||||
function UnicodeFromLocaleChars(CodePage, Flags: Cardinal; LocaleStr: PAnsiChar;
|
||||
LocaleStrLen: Integer; UnicodeStr: PWideChar; UnicodeStrLen: Integer): Integer; overload;
|
||||
|
||||
var
|
||||
temp: widestring;
|
||||
Len: SizeInt;
|
||||
begin
|
||||
widestringmanager.Ansi2WideMoveProc(LocaleStr,CodePage,temp,LocaleStrLen);
|
||||
Len:=Length(temp);
|
||||
// Only move when we have room.
|
||||
if (UnicodeStrLen>0) then
|
||||
begin
|
||||
if UnicodeStrLen<=Len then
|
||||
Len:=UnicodeStrLen-1;
|
||||
JLString(temp).getChars(0,Len,TJCharArray(UnicodeStr),0);
|
||||
UniCodeStr[Len]:=#0;
|
||||
end;
|
||||
// Return length
|
||||
result:=len;
|
||||
end;
|
||||
|
||||
|
||||
{$define FPC_HAS_UNICODECHAR_LEN_TO_STRING}
|
||||
function UnicodeCharLenToString(S : PUnicodeChar;Len : SizeInt) : UnicodeString;
|
||||
|
Loading…
Reference in New Issue
Block a user