[fpc-pascal] FPC 3: disabling automatic AnsiString codepage conversionx

Graeme Geldenhuys mailinglists at geldenhuys.co.uk
Mon Apr 4 12:18:43 CEST 2016

On 2016-04-04 11:07, Michael Van Canneyt wrote:
> if you are dealing with UTF8/UnicodeString and other codepages, it is
> quite likely, and preferred, that you have unit cwstring included.

OK, I just confirmed. Adding clocale to my 5-line test program doesn't
affect the DefaultSystemCodePage result, but as soon as I add cwstring
to the uses clause, then DefaultSystemCodePage returns 65001.

I never use the UnicodeString type, and was under the impression that
only UnicodeString (and WideString) requires the cwstring unit to
function correctly. I use UTF-8 encoded text everywhere (stored inside
String), so never bothered with the cwstring unit. But clearly in FPC
3.0 it is vital to include cwstring if you do anything text related.

Something funny:
  I thought it really funny when Delphi introduced Unicode support, and
how everybody struggled. I thought: "what a mess". Now FPC developers
seem to be in the same boat. :-/

  - Graeme -

fpGUI Toolkit - a cross-platform GUI toolkit using Free Pascal

My public PGP key:  http://tinyurl.com/graeme-pgp

More information about the fpc-pascal mailing list