Menu

#2831 japanese tooltip text is broken of wgnuplot

None
pending-fixed
2025-11-05
2025-10-03
No

Wgnuplot shows tooltip text when mouse cursor is on the icon. These texts is defined at [Button] lines in wgnuplot-ja.mnu for japanese environment. Wgnuplot-ja.mnu also defines menu texts. But, tooltip texts are broken, though menu texts are displayed correctly. Currently the file wgnuplot-ja.mnu is UTF-8 encoding.

The reason of the problem may be the code in src/win/wmenu.c:

#ifdef UNICODE
         button.iString = (UINT_PTR)UnicodeText(ButtonText[i], S_ENC_DEFAULT);
#else

In Japanese environment, S_ENC_DEFAULT = CP932 (Shift_JIS), then it may translate from CP932 to Unicode incorrectly. In fact, tooltip text displayed correctly when I modified S_ENC_DEFAULT to S_ENC_UTF8.
Menu texts may be treated as UTF-8 by

 MultiByteToWideChar(CP_UTF8, 0, buf, MAXSTR, wbuf, MAXSTR);

in src/win/wmenu.c, so I think ButtonText[] should also be treated as UTF8 by changing S_ENC_DEFAULT to S_ENC_UTF8.

Discussion

  • Bastian Märkisch

    • labels: --> Windows, wgnuplot
    • status: open --> pending-fixed
    • assigned_to: Bastian Märkisch
    • Group: -->
    • Priority: -->
     
  • Bastian Märkisch

    You are absolutely correct. In 2021, we changed the encoding of the .mnu files to UTF-8, see Bug [2395]. But I overlooked the case of mouse-over hints, as well as that of image file names. Fixed in master and branch-6-0-stable.

     

Log in to post a comment.