[fpc-pascal] problems using utf8toansi
Jonas Maebe
jonas.maebe at elis.ugent.be
Mon Dec 10 11:10:23 CET 2007
On 10 Dec 2007, at 08:43, Marc Santhoff wrote:
>> You can compile with -al and search for CWSTRING in the assembler
>> file
>> generated for your main program. Since that unit has an
>> initialization
>> section, it will be in the init/final table if it's included
>> somewhere.
>
> Hm, that's funny, the string is not found.
>
> I did:
>
> $ fpc -Fu../zipfile -al -B -FE./bin TestDocInfo
> $ grep -i CWSTRING bin/*.s
>
> and the output was empty.
>
> Meanwhile I had some look and found that DOM is using a type
> "DOMString"
> everywhere which itself is defined as
>
> DOMString = WideString;
>
> so that is an indicator for using widestrings? The uses-line looks
> like
> this:
>
> uses
> {$IFDEF MEM_CHECK}MemCheck,{$ENDIF}
> SysUtils, Classes, AVL_Tree;
>
> Confusing ...
The system and sysutils units contain bare metal widestring support:
i.e., widestring support which only works (as far as alphabetical
ordering, upper/lowercase support and converting from/to ansistrings
is concerned) with ascii values <= #127. It is perfectly possible to
use widestrings in that way, but then they are simply using twice the
memory for no gain whatsoever.
You have to add cwstring on any *nix platform to get actual ansi/
widestring support for your current locale. If you don't, anything
can happen.
Jonas
More information about the fpc-pascal
mailing list