Tcl8.1b3 Unicode question.

3 views
Skip to first unread message

Albert Chen

unread,
Apr 13, 1999, 3:00:00 AM4/13/99
to
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.


jeff_...@my-dejanews.com

unread,
Apr 13, 1999, 3:00:00 AM4/13/99
to k...@ms21.url.com.tw
In article <37133870...@ms21.url.com.tw>,

Albert Chen <k...@ms21.url.com.tw> wrote:
> 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 成功.

What system are you testing it on, and what specs does it have?
I did not encounter a problem getting Chinese chars when I did this
using tkcon on Solaris 2.5.1 with a big5 font installed (of course,
I was then not able to type anything in anymore because of the
encoding...). You have to make sure that a font is available, and
that the terminal you are using can display that font.

--
jeff.hobbs @SPAM acm.org
jeffrey.hobbs @SPAM icn.siemens.de

-----------== Posted via Deja News, The Discussion Network ==----------
http://www.dejanews.com/ Search, Read, Discuss, or Start Your Own

Albert Chen

unread,
Apr 13, 1999, 3:00:00 AM4/13/99
to jeff_...@my-dejanews.com
Jeff Hobbs wrote:

> In article <37133870...@ms21.url.com.tw>,
> Albert Chen <k...@ms21.url.com.tw> wrote:
> > 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 成功.
>
> What system are you testing it on, and what specs does it have?

I'm running FreeBSD 2.2.8-RELEASE with Chinese X server, so
I can see and/or type in Chinese with no problems.

> I did not encounter a problem getting Chinese chars when I did this
> using tkcon on Solaris 2.5.1 with a big5 font installed (of course,
> I was then not able to type anything in anymore because of the
> encoding...). You have to make sure that a font is available, and
> that the terminal you are using can display that font.

*Some* Chinese words that Tcl/Tk can't correct display, such as
成功, 離開 ... etc. You can try those words on tkcon.

Regards,
Albert.


jeff_...@my-dejanews.com

unread,
Apr 14, 1999, 3:00:00 AM4/14/99
to
In article <37136591...@ms21.url.com.tw>,

Albert Chen <k...@ms21.url.com.tw> wrote:
> Jeff Hobbs wrote:
> > In article <37133870...@ms21.url.com.tw>,
> > Albert Chen <k...@ms21.url.com.tw> wrote:
> > > 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 成功.
> >
> > What system are you testing it on, and what specs does it have?
>
> I'm running FreeBSD 2.2.8-RELEASE with Chinese X server, so
> I can see and/or type in Chinese with no problems.
....

> *Some* Chinese words that Tcl/Tk can't correct display, such as
> 成功, 離開 ... etc. You can try those words on tkcon.

OK, between Albert and I, we have determined that Tk (at least my
8.1b3 using tkcon) does display these chinese characters correctly.
Now we have to figure out why a system-set chinese X server isn't
picking up (or translating) the fonts correctly.

Anybody out there with a working chinese system that can help Albert?

lvi...@cas.org

unread,
Apr 14, 1999, 3:00:00 AM4/14/99
to

According to <jeff_...@my-dejanews.com>:
:In article <37133870...@ms21.url.com.tw>,

: Albert Chen <k...@ms21.url.com.tw> wrote:
:> 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 成功.
:
:What system are you testing it on, and what specs does it have?
:I did not encounter a problem getting Chinese chars when I did this

:using tkcon on Solaris 2.5.1 with a big5 font installed (of course,
:I was then not able to type anything in anymore because of the
:encoding...). You have to make sure that a font is available, and
:that the terminal you are using can display that font.

I have a VERY bad feeling about this. Anyone at Scriptics thought about
making sure that not only Tcl/Tk 8.1 is available, but at least links, if
not actual downloads, of UniCode fonts are available, along with install
help info for at least the supported platforms?

--
<URL: mailto:lvi...@cas.org> Quote: Saving the world before bedtime.
<*> O- <URL: http://www.purl.org/NET/lvirden/>
Unless explicitly stated to the contrary, nothing in this posting
should be construed as representing my employer's opinions.

jeff_...@my-dejanews.com

unread,
Apr 14, 1999, 3:00:00 AM4/14/99
to lvi...@cas.org
In article <7f2bhn$4v6$1...@srv38s4u.cas.org>,

lvi...@cas.org (also cc'ed) wrote:
>
> According to <jeff_...@my-dejanews.com>:
> :In article <37133870...@ms21.url.com.tw>,
> : Albert Chen <k...@ms21.url.com.tw> wrote:
> :> I downloaded Tcl8.1b3 to test Chinese words(Big5), I encountered the
> :> problem, see:

> :What system are you testing it on, and what specs does it have?


> :I did not encounter a problem getting Chinese chars when I did this
> :using tkcon on Solaris 2.5.1 with a big5 font installed (of course,

> I have a VERY bad feeling about this. Anyone at Scriptics thought about


> making sure that not only Tcl/Tk 8.1 is available, but at least links, if
> not actual downloads, of UniCode fonts are available, along with install
> help info for at least the supported platforms?

In this case, I was able to use references posted by another user attempting
to get chinese fonts working (they pointed to a Linux HOW-TO, which was
essentially the same for Solaris, and a semi-official site for chinese fonts).

That was quasi-luck to see that post, so perhaps this (very complicated)
topic could use some elaboration, but where is really the correct place?

Scott Stanton

unread,
Apr 27, 1999, 3:00:00 AM4/27/99
to Albert Chen
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....@scriptics.com
The Tcl Platform Company http://www.scriptics.com

Reply all
Reply to author
Forward
0 new messages