Unicode support inconsistency between menu titles and menu items on Windows

From: Eric Brunel (eric.brunel_at_N0SP4M.com)
Date: 02/25/04


Date: Wed, 25 Feb 2004 12:12:42 +0100

Hi all,

Consider the following script:

--test-unicode.tcl---------------------
menu .mb
. configure -menu .mb

menu .mb.m1
set s1 "\xe3\x81\xb2\xe3\x82\x89\xe3\x81\x8c\xe3\x81\xaa"
.mb add cascade -label [encoding convertfrom utf-8 $s1] -menu .mb.m1
set s2 "\xe3\x82\xab\xe3\x82\xbf\xe3\x82\xab\xe3\x83\x8a"
.mb.m1 add command -label [encoding convertfrom utf-8 $s2]

menu .mb.m2
set s3 "G\xc3\xa9n\xc3\xa9ration"
.mb add cascade -label [encoding convertfrom utf-8 $s3] -menu .mb.m2
set s4 "Pr\303\251f\303\251rences"
.mb.m2 add command -label [encoding convertfrom utf-8 $s4]
---------------------------------------

The string s1 and s2 contain japanese characters; the strings s3 and s4 contain
french accented letters, all in utf-8 encoding.

Executing this script on Linux or Solaris works as expected: all characters are
displayed.

On a french Windows 2k without any japanese font installed, the japanese
characters are displayed as '?' in the menu title and as squares in the menu
items. The french characters are displayed correctly.

On a french Windows 2k with a japanese font installed, the japanese characters
in menu items are displayed correctly, but not in menu titles: they still show
up as '?'. The french characters are still displayed correctly.

What is the reason for that? Will japanese characters show up correctly on a
Japanese version of Windows? And will the french characters show up? Would it be
different if I had a newer Windows version (namely XP)?

Since I thought every string was managed internally in unicode on Windows, I
also tried to add a "encoding system utf-8" at the top of the script. Then the
non-ASCII characters in menu titles show up completely messed up.

For info, I'm using tcl/tk 8.3.4; "encoding system" returns cp1252

-- 
- Eric Brunel <eric dot brunel at pragmadev dot com> -
PragmaDev : Real Time Software Development Tools - http://www.pragmadev.com


Relevant Pages

  • Re: _stprintf
    ... Some versions of Windows implement DBCS, apparently the Japanese version of Windows had ... This also means that if you are using Unicode to represent Kanji, ... to use MAX_PATH Kanji characters to name a file. ...
    (microsoft.public.vc.mfc)
  • Re: Japanese displays incorrectly
    ... That's because Windows is set to handle Unicode correctly but not the ... >> that I've set up to display and enter Japanese, ... >> characters. ... the list pane does not display Japanese ...
    (microsoft.public.windows.inetexplorer.ie6_outlookexpress)
  • Re: MFC application textbox input overflow on Japanese Windows 2000
    ... On Windows 2K the default dialog font did not contain Japanese characters. ...
    (microsoft.public.vc.mfc)
  • WS4HTM.BAS, was Re: Scelbis 8080 standard monitor
    ... except the problem that Windows does not have ... the same "extended" characters than MS-DOS. ... french text, containing accented characters, display correctly on my ... When you load the French file into Wordstar you see strange characters, ...
    (comp.os.cpm)
  • Re: Filename Encoding Help
    ... The problem is I am almost certain that Windows XP stores filenames in UTF-16 but I am not sure what Windows Vista does. ... The ANSI character set will handle any characters in the ASCII character set. ... Again it is a program that stores file names on Windows XP and Windows Vista into a text file, however the file can be opened by Windows 9x/me. ... I have Windows XP (Japanese) and I store the filenames in an ANSI text file. ...
    (microsoft.public.dotnet.framework)

Loading