[fpc-pascal] CodePage fallback for FreeBSD systems
Graeme Geldenhuys
mailinglists at geldenhuys.co.uk
Thu Sep 10 14:19:35 CEST 2015
Hi,
I have a slight issue with a patch made in FPC, and will be included in
the 3.0 release.
https://github.com/graemeg/freepascal/commit/aef238f18a04bce621c452fbdcfac46613001e6c
============================================
[src (master)]$ git log aef238f18a04bce6
commit aef238f18a04bce621c452fbdcfac46613001e6c
Author: Jonas Maebe <jonas.maebe at elis.******>
Date: Thu Dec 11 19:11:11 2014 +0000
* fall back to UTF-8 for darwin in unixcp.GetSystemCodePage if no
LC_*/LANG
environment variables are set
* if no LC_*/LANG environment variables are set, let cwstring fall
back to
unixcp.GetSystemCodePage
o this is mainly to avoid problems on OS X, where under certain
circumstances these variables are not set for GUI programs and
as a result we set the system code page to ASCII
git-svn-id: http://svn.freepascal.org/svn/fpc/trunk@29257
3ad0048d-3df7-0310-abae-a5850022a9f2
============================================
See the last file changed.... rtl/unix/unixcp.pp
It seems it excludes FreeBSD in that $IF statement. Darwin is after all
a FreeBSD fork. This results to cwstrings under FreeBSD to default to
ASCII. :-/
----------[ rtl/unix/unixcp.pp ]---------------
function GetSystemCodepage: TSystemCodePage;
var
p: SizeInt;
lang: ansistring;
cp: TSystemCodePage;
begin
// Get one of non-empty environment variables in the next order:
// LC_ALL, LC_CTYPE, LANG. Default is UTF-8 or ASCII.
{$if defined(linux) or defined(darwin)}
Result:=CP_UTF8;
{$else}
Result:=CP_ASCII;
{$endif linux}
-----------------------------------------------
Any specific reason why FreeBSD is excluded from the $IF statement?
Regards,
- Graeme -
--
fpGUI Toolkit - a cross-platform GUI toolkit using Free Pascal
http://fpgui.sourceforge.net/
More information about the fpc-pascal
mailing list