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.

Why a " ² " become " ? "

Help for those learning Tcl or writing their own scripts.
Post Reply
C
Caribou
Voice
Posts: 28
Joined: Thu Apr 15, 2004 12:51 pm
Location: France

Why a " ² " become " ? "

Post by Caribou »

Hello, i have a weird bug about a character, the " ² ", when i write it in a text file, it make it " ? ", and i don't really understand why, i can't find any thread about this, maybe i didn't used the correct key-words to find it but well.

Someone have any clue about this ?

I guess the " ² " isn't the only character who is affected.
User avatar
De Kus
Revered One
Posts: 1361
Joined: Sun Dec 15, 2002 11:41 am
Location: Germany

Post by De Kus »

read about character tables and character encodings.
De Kus
StarZ|De_Kus, De_Kus or DeKus on IRC
Copyright © 2005-2009 by De Kus - published under The MIT License
Love hurts, love strengthens...
C
Caribou
Voice
Posts: 28
Joined: Thu Apr 15, 2004 12:51 pm
Location: France

Post by Caribou »

Thanks De Kus,

I did a search about encoding and i find out a solution, i used fconfigure command, i don't really know where to had it, so i made it just before writing in my text file. and now when i open the .txt file i got the " ² " instead of " ? " :D

Code: Select all

 if {![catch {set fileWri [open nick2.txt w]}]} {
   fconfigure $fileWri -encoding binary
   puts $fileWri "$arg"
   close $fileWri
 }
But re-using fconfigure each times i write in my .txt is the right thing to do i hope?
User avatar
De Kus
Revered One
Posts: 1361
Joined: Sun Dec 15, 2002 11:41 am
Location: Germany

Post by De Kus »

yes, unless you can change the default encoding thats used. I dont know if the default is the eggdrops default or the systems default. Because eggdrop should use iso-8659-1 which supports these characters your shell probably uses us-ascii which is not that good imho. But maybe its also strict UTF-8 which of course does not recognize single byte values over 127.
De Kus
StarZ|De_Kus, De_Kus or DeKus on IRC
Copyright © 2005-2009 by De Kus - published under The MIT License
Love hurts, love strengthens...
Post Reply