When I ran the above statements, and redirect to a file. It has c080
values
Done use redirection of stdout (due to encodings), instead:
1) open a file
2) fconfigure to binary
3) puts to it
4) close the file
BTW, you could also just do:
set str \x00
or
set str \0
--
+--------------------------------+---------------------------------------+
| Gerald W. Lester | "The man who fights for his ideals is |
| Gerald...@cox.net | the man who is alive." -- Cervantes |
+--------------------------------+---------------------------------------+
1) Please read http://wiki.tcl.tk/endekalogue
2) If after reading (1), you do not understand backslash substitution, go to
step (1)
If you are dealing with binary, make sure to do:
fconfigure $fileid -translation binary
--
Jeff Hobbs, The Tcl Guy
http://www.ActiveState.com/, a division of Sophos
This looks more to me like a unicode encoding of ASCII NUL. It doesn't
look like it has anything to do with backslashes, but with encodings.
--
Darren New, San Diego CA USA (PST)
I am in geosynchronous orbit, supported by
a quantum photon exchange drive....
Basically it is a bug in Tcl's encoding. c080 is used as the Tcl
internal code for NUL, so the usual C string functions can be used. As
the use of non-shortest encodings was outlawed by the unicode consortium
a while ago.
(mainly due to security problems of various vendors, one very prominent
case was the really really broken code in M$ IIS getting it horribly
wrong due to stupidity (check access than normalize path instead of
normalize than check)).
So your above code probably should work, as co80 was a valid NULL in
some UTF-8, but nowadays this is broken.
Michael
What encoding did you want the file in? What is your system encoding?
If the answer to both is utf-8, then...
Michael Schlenker wrote:
> Basically it is a bug in Tcl's encoding. c080 is used as the Tcl
> internal code for NUL, so the usual C string functions can be used.
Otherwise, if you want to write binary data to stdout without any
encoding changes, be sure to configure for that:
fconfigure stdout -encoding binary -translation binary
--
| Don Porter Mathematical and Computational Sciences Division |
| donald...@nist.gov Information Technology Laboratory |
| http://math.nist.gov/~DPorter/ NIST |
|______________________________________________________________________|
There was some discussion of this topic before Xmas between some UNICODE
people and some of the Core Team. We couldn't reach agreement over what
the right way forward was; their preferred solutions (which varied from
making the app exit immediately to substituting such sequences with the
UNICODE "unknown character sequence" character) would have broken far
too much existing code and data for our taste, and our preferred
solutions (which can be summed up largely by the IETF dictum "Be liberal
in what you accept and strict in what you generate") had them throwing
up their arms in horror. We did not see eye-to-eye... :^(
Donal.