Overview
| Artifact ID: | bcfb26dc88f1e14e7aa8bceb3b7d1704b954fbcd |
|---|---|
| Ticket: | 840577ffffffffffffffffffffffffffffffffff
Problem in reading nonascii character. |
| User & Date: | aniixx on 2003-11-12 09:00:29 |
Changes
- assignee changed to: "nobody"
- cmimetype changed to: "text/plain"
- comment changed to:
Hi, We have Tcl integrated with C++ application. The user commands from tclsh are mapped to the C++ functions & handled in the C++ application. We are facing some problem while reading nonascii characters from a file. I have given some commands that I have tried for your reference below. Check the octal dumps to verify the contents of the file. While reading or storing it in a Tcl variable, Tcl does some kind of encoding (possibly UTF-8 encoding). But puts strips the extra character off or decodes it. Any idea if it's a Tcl bug? We pass this variable to C++ application & on the other end we get wrong output (extra character). Thanx, Aniket $ echo "abc\200xyz" > /tmp/wipro $ od -xC /tmp/wipro 0000000 6162 6380 7879 7a0a a b c 200 x y z \n 0000010 $ xmytclsh > set fd [ open /tmp/wipro r] > set data [ read -nonewline $fd ] > puts $data abcxyz > echo $data abcÂxyz > set fd [ open /tmp/wipro r] > set data [ read $fd ] > puts $data abcxyz > echo $data abcÂxyz > set fdw [ open /tmp/wipro_write w] > puts $fdw $data > close $fdw > set data "abc\0200xyz" > echo $data abc0xyz > puts $data abc0xyz > exit $ od -xC /tmp/wipro_write 0000000 6162 6380 7879 7a0a 0a00 a b c 200 x y z \n \n 0000011 Note: Octal dump if abcÂxyz is passed to C++ appln & received at output is 0000000 6162 63c2 8078 797a a b c  200 x y z 0000010 You can surely see additional character  here. - foundin changed to: "None"
- priority changed to: "5 Medium"
- resolution changed to: "None"
- status changed to: "Open"
- submitter changed to: "aniixx"
- subsystem changed to: "None"
- title changed to: "Problem in reading nonascii character."
- type changed to: "Bug"