mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-04-22 09:19:32 +02:00
LCL: fixed GetSystemEncoding on windows.
git-svn-id: trunk@15194 -
This commit is contained in:
parent
177dcdbe22
commit
9454cec7f7
@ -94,25 +94,14 @@ var EncodingValid: boolean = false;
|
||||
{$IFDEF Windows}
|
||||
function GetWindowsEncoding: string;
|
||||
var
|
||||
{$ifdef WinCE}
|
||||
Buffer : PWideChar;
|
||||
{$else}
|
||||
Buffer : PChar;
|
||||
{$endif}
|
||||
Size : integer;
|
||||
cp : UINT;
|
||||
begin
|
||||
Size := GetLocaleInfo (LOCALE_USER_DEFAULT, LOCALE_ILANGUAGE, nil, 0);
|
||||
GetMem(Buffer, Size);
|
||||
try
|
||||
GetLocaleInfo (LOCALE_USER_DEFAULT, LOCALE_ILANGUAGE, Buffer, Size);
|
||||
Result := string(Buffer);
|
||||
while (Result<>'') and (Result[1]='0') do
|
||||
Result:=copy(Result,2,length(Result));
|
||||
if Result<>'' then
|
||||
Result:='cp'+Result;
|
||||
finally
|
||||
FreeMem(Buffer);
|
||||
end
|
||||
cp := GetACP;
|
||||
case cp of
|
||||
CP_UTF8: Result := EncodingUTF8;
|
||||
else
|
||||
Result:='cp'+IntToStr(GetACP);
|
||||
end;
|
||||
end;
|
||||
{$ENDIF}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user