[fpc-pascal] Question mark?

Jonas Maebe jonas.maebe at elis.ugent.be
Fri Sep 10 21:03:41 CEST 2010


On 10 Sep 2010, at 20:21, Luis Fernando Del Aguila Mejía wrote:

> In the following program:
> 
> {$ Codepage UTF8}
> var str: string;
> Begin
> Readln (str);
> Writeln (str)
> End.
> 
> When I enter the following: €uro, shows me: ?uro.
> The console uses 850 and S.O. 1252, for non-Unicode programs.
> My question is:
> Who puts the question mark?
> The widestring manager or my console.

It can be either, but it's probably the widestring manager in this case (it uses a question mark to replace characters that cannot be represented in the current character set; this is detected by the OS' widestring manager returning an error, or in certain cases the the OS' widestring conversion routines themselves will replace unrepresentable characters with '?').

If you are on a Unix platform, remember to add the "cwstring" unit to your uses clause.


Jonas


More information about the fpc-pascal mailing list