summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormarco <marco@3ad0048d-3df7-0310-abae-a5850022a9f2>2021-04-22 14:00:51 +0000
committermarco <marco@3ad0048d-3df7-0310-abae-a5850022a9f2>2021-04-22 14:00:51 +0000
commitd7efd1db7e2da4157afc0a06fa76eadccfff021d (patch)
tree749ccbce118454966055a850eb5005bc4e901d3d
parentde2e3396159b746f3a9178a59b144ce9cd1c06fd (diff)
downloadfpc-d7efd1db7e2da4157afc0a06fa76eadccfff021d.tar.gz
* use W variant to get localestrs.
git-svn-id: https://svn.freepascal.org/svn/fpc/trunk@49244 3ad0048d-3df7-0310-abae-a5850022a9f2
-rw-r--r--rtl/win/sysutils.pp12
1 files changed, 8 insertions, 4 deletions
diff --git a/rtl/win/sysutils.pp b/rtl/win/sysutils.pp
index 726b389fe2..594fc0abfc 100644
--- a/rtl/win/sysutils.pp
+++ b/rtl/win/sysutils.pp
@@ -1037,14 +1037,18 @@ end;
Locale Functions
****************************************************************************}
-function GetLocaleStr(LID, LT: Longint; const Def: string): ShortString;
+function GetLocaleStr(LID, LT: Longint; const Def: string): AnsiString;
var
L: Integer;
- Buf: array[0..255] of Char;
+ Buf: unicodestring;
begin
- L := GetLocaleInfoA(LID, LT, Buf, SizeOf(Buf));
+ L := GetLocaleInfoW(LID, LT, nil, 0);
if L > 0 then
- SetString(Result, @Buf[0], L - 1)
+ begin
+ SetLength(Buf,L-1); // L includes terminating NULL
+ L := GetLocaleInfoW(LID, LT, @Buf[1], L);
+ result:=buf;
+ end
else
Result := Def;
end;