This is the new home of the egghelp.org community forum.
All data has been migrated (including user logins/passwords) to a new phpBB version.


For more information, see this announcement post. Click the X in the top right-corner of this box to dismiss this message.

What wrong?-- puts -nonewline $file_no \xc0

Help for those learning Tcl or writing their own scripts.
Post Reply
z
zhjwp
Voice
Posts: 2
Joined: Wed Mar 12, 2008 3:55 am

What wrong?-- puts -nonewline $file_no \xc0

Post by zhjwp »

#!/usr/bin/expect -f

set file_no [open ./test w]
puts -nonewline $file_no \xc0

But the output is two bytes: 0xc3 0x80.
(If it is \x7c, it is can be output correctly. It seems that as long as the highest bit is 1, the output is incorrect)
What is wrong?

Thanks!!!

zhang
User avatar
user
 
Posts: 1452
Joined: Tue Mar 18, 2003 9:58 pm
Location: Norway

Re: What wrong?-- puts -nonewline $file_no \xc0

Post by user »

zhjwp wrote:What is wrong?
utf-8

You probably want

Code: Select all

fconfigure $file_no -translation binary
Have you ever read "The Manual"?
z
zhjwp
Voice
Posts: 2
Joined: Wed Mar 12, 2008 3:55 am

Post by zhjwp »

Thanks a lot! It is a great help!!
Post Reply