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

2010-02-19 Thread JoshyFun
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

___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal


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

2010-02-19 Thread JoshyFun
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.

Well I do not know the writeln internals, but if writeln writes 7
bytes and windows returns -6 characters- output rtl could understand
that a write error happends.

-- 
Best regards,
 JoshyFun

___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal


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

2010-02-19 Thread Tomas Hajny
On 19 Feb 10, at 17:27, JoshyFun wrote:
> Friday, February 19, 2010, 3:22:15 AM, you wrote:
> 
> LFDAM> Ok,
> LFDAM> The steps are :
> LFDAM> 1) Change the Font Type at Lucida Console Font :
> LFDAM> http://www.conoce3000.com/fig01.jpg
> LFDAM> 2) Compile the program with fpc 2.4. :
> LFDAM> 3) change to UTF8, with chcp 65001 command
> LFDAM> 4) run the program
> LFDAM> Step 01 to 04 : http://www.conoce3000.com/fig02.jpg
> LFDAM> The source code : http://www.conoce3000.com/Prueba005.pp
> LFDAM> The error ocurred only when use Lucida console Font.
> 
> The problem is that by default in Windows stdout is opened in 7 bits
> mode (text), this means that writeln when emits some information in
> UTF8 with any char >127 will enter in some kind of error reported from
> rtl or Windows kernel.

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

Tomas

___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] Thread IDs

2010-02-19 Thread Wimpie Nortje


I found some inconsistencies a couple of months ago, but never got to 
creating a bug report:

http://www.mail-archive.com/fpc-pascal@lists.freepascal.org/msg17337.html

lists.freepascal.org seems down, so I found this link.

VIncent
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal


Bug report created.
http://bugs.freepascal.org/view.php?id=15821
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal


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

2010-02-19 Thread JoshyFun
Hello FPC-Pascal,

Friday, February 19, 2010, 3:22:15 AM, you wrote:

LFDAM> Ok,
LFDAM> The steps are :
LFDAM> 1) Change the Font Type at Lucida Console Font :
LFDAM> http://www.conoce3000.com/fig01.jpg
LFDAM> 2) Compile the program with fpc 2.4. :
LFDAM> 3) change to UTF8, with chcp 65001 command
LFDAM> 4) run the program
LFDAM> Step 01 to 04 : http://www.conoce3000.com/fig02.jpg
LFDAM> The source code : http://www.conoce3000.com/Prueba005.pp
LFDAM> The error ocurred only when use Lucida console Font.

The problem is that by default in Windows stdout is opened in 7 bits
mode (text), this means that writeln when emits some information in
UTF8 with any char >127 will enter in some kind of error reported from
rtl or Windows kernel.

I do not know how to inform the fpc to "reopen" the stdout handle in
binary mode, but you can "hack it" by (at least for tests):

-
uses classes,windows;

var
 s: string;
 OutputStream: TStream;
Begin
 Writeln('code page UTF8 - 65001 en Windows');
 OutputStream := THandleStream.Create(GetStdHandle(STD_OUTPUT_HANDLE));
 s:='camión';
 OutputStream.write(s[1],Length(s));
 OutputStream.free;
End.
-

-- 
Best regards,
 JoshyFun

___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal