mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-09-06 00:30:34 +02:00
* default to UTF-8 as system code page in case nl_langinfo(CODESET) returns
an empty string git-svn-id: trunk@19964 -
This commit is contained in:
parent
33544c63d0
commit
f287cf3f61
@ -874,8 +874,18 @@ begin
|
||||
end;
|
||||
|
||||
function GetStandardCodePage(const stdcp: TStandardCodePageEnum): TSystemCodePage;
|
||||
var
|
||||
langinfo: pchar;
|
||||
begin
|
||||
Result := iconv2win(ansistring(nl_langinfo(CODESET)))
|
||||
langinfo:=nl_langinfo(CODESET);
|
||||
{ there's a bug in the Mac OS X 10.5 libc (based on FreeBSD's)
|
||||
that causes it to return an empty string of UTF-8 locales
|
||||
-> patch up (and in general, UTF-8 is a good default on
|
||||
Unix platforms) }
|
||||
if not assigned(langinfo) or
|
||||
(langinfo^=#0) then
|
||||
langinfo:='UTF-8';
|
||||
Result := iconv2win(ansistring(langinfo));
|
||||
end;
|
||||
|
||||
{$ifdef FPC_HAS_CPSTRING}
|
||||
|
Loading…
Reference in New Issue
Block a user