[fpc-pascal] Re: Ido not understand UTF8 in Windows

JoshyFun joshyfun at gmail.com
Sat Feb 20 01:15:46 CET 2010


Hello Tomas,

Friday, February 19, 2010, 11:55:39 PM, you wrote:

TH> No, this can't work that way, otherwise output of any accented
TH> character in one of the Windows codepages would result in the same
TH> error.

Tested the "wrong" return of stdout:

code page UTF8 - 65001 en Windows
Length of string: 7
camión -> Returned written: 6

Source code:
-------------------------------------
uses classes,windows;
var
 s: ansistring;
 OutputStream: TStream;
Begin
 Writeln('code page UTF8 - 65001 en Windows');
 OutputStream := THandleStream.Create(GetStdHandle(STD_OUTPUT_HANDLE));
 s:='cami'+#$C3+#$B3+'n'; //camión
 writeln('Length of string: ',Length(s));
 writeln(' -> Returned written: ',OutputStream.write(s[1],Length(s)));
 OutputStream.free;
End.


-- 
Best regards,
 JoshyFun




More information about the fpc-pascal mailing list