Re: Decoding CJK characters to unicode in Tcl



On 14 mrt, 18:25, jhe...@xxxxxxxxx wrote:
I know how to display Chinese characters in Tk, such as wm title,
button names, etc. For example,
% wm title . "\u592a\u9177"
% button .f -text "\u592a\u9177" -font {-family MingLiU -size 16 -
weight bold}
I'll see "太 酷" (very cool).
My problem is how to decode a CJK character to its unicode in Tcl
given the CJK unicode table:
0 1 2 3 4 5 6 7 8 9 a b c d e f
4E00 一 丁 丂 七 丄 丅 丆 万 丈 三 上 下 丌 不 与 丏
4E10 丐 丑 丒 专 且 丕 世 丗 丘 丙 业 丛 东 丝 丞 丟
4E20 丠 両 丢 丣 两 严 並 丧 丨 丩 个 丫 丬 中 丮 丯
...
In tkcon, I can set a Chinese charter, i.e.
% set x 丏;
tkcon can display $x.
When I use "read" to load the table, tkcon cannot display it in
Chinese (I got ??? for Chinese characters).
If I combine $x with other string, i.e.
% set y "abc 丏".
% I'll get no match, 0 when I try:
% string math $x $y.
Any thought? Thanks in advance!


What if you try to match "*丏"to $y:

% string match $x $y
1

- this works for me.

[string match] tries to match the whole string, but to do that the
pattern
usually requires a wildcard (* or ?)

The problem with the display of the characters may be due to the lack
of the
proper Chinese fonts?

Regards,

Arjen