[fpc-devel] UTF8 RTL
jonas.maebe at elis.ugent.be
Sun Nov 23 18:09:34 CET 2014
On 23/11/14 17:46, Marco van de Voort wrote:
> So now we support changing defaultsystemcodepage formally by endusers? I was
> not made aware of that.
There is the SetMultiByteConversionCodePage() routine in the interface
of the system unit that does exactly that. It's kind of strange to have
such a routine if using it is not supported.
> And aside from formal status, that is IMHO a hack, and an incompatible (to
> both old and new delphi) to start with.
That routine comes from Delphi and does the same there.
> It moves removes the conversions from a few RTL routines, but keeps the
> "insert conversion here" barrier to all other interfacing to the system
> firmly intact. And I already mentioned it is incompatible.
> I assume this will also make default I/O utf8 etc, which makes no sense.
It depends on what you mean by "default I/O". It won't change standard
input/output to UTF-8 on Windows, as every textrec has its own codepage
settings and those for standard input/output are initialised with
concrete code page numbers on startup (see OpenStdIO in
rtl/inc/textrec.inc, and Win32GetStandardCodePage() in rtl/win/syswin.inc.
On Unix, it will change the code page of stdio, because there the stdio
textrecs are initialised with the value of defaultsystemcodepage
(DefaultGetStandardCodePage() in rtl/inc/ustrings.inc), which is still
CP_ACP at that point. We could fix this by adding code to the
initialisation of cwstring to set the codepage of those textrecs to the
concrete code pages though (which we probably should do anyway).
More information about the fpc-devel