Subject: Re: Tcl8.1b3 Unicode question. - DN [1]
Scott Stanton <scott.stanton@Scriptics.com> - 27 Apr 1999 - comp.lang.tcl
Albert Chen wrote: > > Hi, > > I downloaded Tcl8.1b3 to test Chinese words(Big5), I encountered the > problem, see: > > %encoding system big5 > %puts "жие\" > > after executing the command puts, it can't successfully print the > Chinese word жие\. > Would anyone tell me how to do with unicode on Tcl, thanks. > > -Albert. Be careful about using the "encoding system" command. What this command does is to control the encoding used when communicating with system calls. If it doesn't match the actual encoding used by your system, then you will have all sorts of problems (a common manifestation is the inability to open any files). The main reason you would need to use this is if Tcl can't figure out the proper encoding from your env(LANG) or env(LC_CTYPE) values. In any case, be very careful with this command as it can leave you with a non-functional interpreter. If you are trying to control the encoding used to read or write to a channel, then you should use the "fconfigure $file -encoding" command instead. This allows you to control the encoding on a channel-by-channel basis. This is almost always the correct command to use, rather than "encoding system". Once you have your data in Tcl correctly with the right Unicode character values, then Tk should automatically map from Unicode to the encoding used by your X fonts. At this point it should be a matter of selecting a font that is capable of displaying your characters and letting Tk handle the encoding translations. ___________________________________________________________ Scott Stanton 650-210-0105 tel Sr. Software Engineer 650-210-0101 fax Scriptics Corporation scott.stanton@scriptics.com The Tcl Platform Company http://www.scriptics.com
Last modified
1999-09-27
1999-09-27
(195.108.246.50)
Note: you are looking at
the snapshot of an old wiki
- much of this information
is likely to be very outdated
