[fpc-devel] Very simple questions about Widestring on Linux

Jonas Maebe jonas.maebe at elis.ugent.be
Tue Mar 17 23:10:09 CET 2009


On 17 Mar 2009, at 22:51, Léo Willian Kölln wrote:

> No problems so far, but when i want to implement my functions using
> the RTL, i just see arguments, parameters and returns of String.
> As far i´ve read, they are aways Ansistrings, i´m right? Or i need
> inform the compiler of this? (Q1)

It depends on which unit. Everything in sysutils accepts/returns  
ansistrings, yes. Older units, like the Dos unit, accept/return  
shortstrings (these also use the ansi-encoding though). You cannot  
change this using a compiler switch, as it is part of the way the  
unit's interfaces are defined.

> To convert to Widestrings, i need include the unit "cwstring".
> Where? Only at the main unit, or on every unit where an RTL function
> is called? (Q2)

Only in your main program.

> The conversion is transparent, in both ways? (Q3)

Yes.

> And for a stupid question:
> If my host (linux) machine is using, for example, an ISO8859-1 coding
> (file names, etc...) or even a more exotic one.
> The conversion will be transparent, in both ways? (Q4)

Characters not representable in the "ansi" encoding of the machine,  
will get lost when converting from widestring to ansistring. This will  
be solved once we implement support for Delphi2009's new "ansistring- 
with-codepage" type.


Jonas


More information about the fpc-devel mailing list