For Programmers: Free Programming Magazines  


Home > Archive > Tcl > February 2007 > Re: "string map" causes problems with german umlauts since version









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author Re: "string map" causes problems with german umlauts since version
Gerald W. Lester

2007-02-23, 7:14 pm

Could you post the default encoding in each case?

MartinLemburg@UGS wrote:
> Hello again,
>
> I extended the example a bit and let it run on tcl 8.4.13, on tclkitsh
> 8.5a4, on tclkit 8.5a4:
>
> tcl shell 8.4.13:
> % set a "äöüÄÖÜ"
> äöüÄÖÜ
> % set b [string map {. ,} $a]
> äöüÄÖÜ
> % string length $b
> 6
> % format %c [scan [string index $b 0] %c]
> ä
> % scan [string index $b 0] %c
> 228
> % set fid [open f:/umlautTest.txt w];
> file9cc228
> % puts $fid $b;
> % close $fid;
> % set fid [open f:/umlautTest.txt r];
> file9cc368
> % set c [read $fid];
> äöüÄÖÜ
>
> % close $fid
>
> tclkitsh 8.5a4:
> % set a "äöüÄÖÜ"
> äöüÄÖÜ
> % set b [string map {. ,} $a]
> ´¥ä´¥ö´¥ü´¥Ä´¥Ö´¥Ü
> % string length $b
> 6
> % format %c [scan [string index $b 0] %c]
> ´¥ä
> % scan [string index $b 0] %c
> 65412
> % set fid [open f:/umlautTest.txt w];
> filea277a8
> % puts $fid $b;
> % close $fid;
> % set fid [open f:/umlautTest.txt r];
> file9e1b08
> % set c [read $fid];
> ??????
>
> % close $fid
>
> tclkit 8.5a4:
> (bin) 1 % set a "äöüÄÖÜ"
> äöüÄÖÜ
> (bin) 2 % set b [string map {. ,} $a]
> äöüÄÖÜ
> (bin) 3 % string length $b
> 6
> (bin) 4 % format %c [scan [string index $b 0] %c]
> ä
> (bin) 5 % scan [string index $b 0] %c
> 228
> (bin) 6 % set fid [open f:/umlautTest.txt w];
> filee9b6b8
> (bin) 7 % puts $fid $b;
> (bin) 8 % close $fid;
> (bin) 9 % set fid [open f:/umlautTest.txt r];
> filee9b9e0
> (bin) 10 % set c [read $fid];
> äöüÄÖÜ
>
> (bin) 11 % close $fid
>
> What's going on with the tclkitsh 8.5a4?
> Why the written text file contains not the data, that should have been
> in there "äöüÄÖÜ"?
>
> Best regards,
>
> Martin Lemburg
> UGS - a Siemens Company - Transforming the Process of Innovation
>
> On Feb 23, 2:28 pm, "MartinLemburg@UGS" <martin.lemburg....@gmx.net>
> wrote:
>
>



--
+--------------------------------+---------------------------------------+
| Gerald W. Lester |
|"The man who fights for his ideals is the man who is alive." - Cervantes|
+------------------------------------------------------------------------+
Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com