--- Begin Message ---
Hi Antoine,
On 9/26/06, A.J.Mechelynck <[EMAIL PROTECTED]> wrote:
Yongwei Wu wrote:
[...]
> It looks like a UTF-8 string is displayed as a GBK string. I confirmed
> it by (in a CP936 console):
>
> $ echo 关闭标签|iconv -f cp936 -t utf-8
> ��抽�����绛�
>
> The resulting string is exactly what I get in UTF-8 mode. (There are
> 4*3/2 = 6 characters, but you may only see 5 since 0xADBE is not a
> valid code point for GBK.)
[...]
I see six, which translate into UTF-8 as U+934F U+62BD U+68F4 U+93CD U+56E9
U+E137, i.e. �� wéi (undefined), 抽 chōu (to pull out), �� fú (undefined), ��
lúo (undefined, but traditional for U+9559 镙, also undefined), �� yùn
(undefined) and (E137: not found in Unihan database; U+E000-U+F8FF is a
"Private area" range; Thunderbird displays the corresponding GB2312 character
with the same glyph as U+5E09 �� fēn, undefined). Transliterations above
represent the Mandarin reading according to the pinyin representation.
The original string, guānbì biāoqiān, might mean "close tab" or something like
that (the individual ideograms seem to mean "close-lock-label-paper slip" but
from the context it can only be one of "close tab" "new tab" or "open tab..."
:-) ).
Can you try the attached patch to see whether this problem is
fixed or not? The patch is against the latest Vim7 version from CVS.
I am not familiar with Unicode and I don't have a setup to test the fix
for this issue.
Thanks,
Yegappan
Index: src/gui_w48.c
===================================================================
RCS file: /cvsroot/vim/vim7/src/gui_w48.c,v
retrieving revision 1.36
diff -c -p -r1.36 gui_w48.c
*** src/gui_w48.c 29 Aug 2006 19:26:10 -0000 1.36
--- src/gui_w48.c 27 Sep 2006 17:20:31 -0000
*************** gui_mch_show_toolbar(int showit)
*** 2217,2226 ****
#if defined(FEAT_GUI_TABLINE) || defined(PROTO)
static void
show_tabline_popup_menu(void)
{
HMENU tab_pmenu;
- MENUITEMINFO minfo;
long rval;
POINT pt;
--- 2217,2273 ----
#if defined(FEAT_GUI_TABLINE) || defined(PROTO)
static void
+ add_tabline_popup_menu_entry(pmenu, item_id, item_text)
+ HMENU pmenu;
+ UINT item_id;
+ char_u *item_text;
+ {
+ #ifdef FEAT_MBYTE
+ WCHAR *wn = NULL;
+ int n;
+
+ if (enc_codepage >= 0 && (int)GetACP() != enc_codepage)
+ {
+ /* 'encoding' differs from active codepage: convert menu name
+ * and use wide function */
+ wn = enc_to_ucs2(item_text, NULL);
+ if (wn != NULL)
+ {
+ MENUITEMINFOW infow;
+
+ infow.cbSize = sizeof(infow);
+ infow.fMask = MIIM_TYPE | MIIM_ID;
+ infow.wID = item_id;
+ infow.fType = MFT_STRING;
+ infow.dwTypeData = wn;
+ infow.cch = (UINT)wcslen(wn);
+ n = InsertMenuItemW(pmenu, item_id, FALSE, &infow);
+ vim_free(wn);
+ if (n == 0 && GetLastError() == ERROR_CALL_NOT_IMPLEMENTED)
+ /* Failed, try using non-wide function. */
+ wn = NULL;
+ }
+ }
+
+ if (wn == NULL)
+ #endif
+ {
+ MENUITEMINFO info;
+
+ info.cbSize = sizeof(info);
+ info.fMask = MIIM_TYPE | MIIM_ID;
+ info.wID = item_id;
+ info.fType = MFT_STRING;
+ info.dwTypeData = item_text;
+ info.cch = (UINT)STRLEN(item_text);
+ InsertMenuItem(pmenu, item_id, FALSE, &info);
+ }
+ }
+
+ static void
show_tabline_popup_menu(void)
{
HMENU tab_pmenu;
long rval;
POINT pt;
*************** show_tabline_popup_menu(void)
*** 2236,2256 ****
if (tab_pmenu == NULL)
return;
! minfo.cbSize = sizeof(MENUITEMINFO);
! minfo.fMask = MIIM_TYPE|MIIM_ID;
! minfo.fType = MFT_STRING;
!
! minfo.dwTypeData = _("Close tab");
! minfo.wID = TABLINE_MENU_CLOSE;
! InsertMenuItem(tab_pmenu, TABLINE_MENU_CLOSE, FALSE, &minfo);
!
! minfo.dwTypeData = _("New tab");
! minfo.wID = TABLINE_MENU_NEW;
! InsertMenuItem(tab_pmenu, TABLINE_MENU_NEW, FALSE, &minfo);
!
! minfo.dwTypeData = _("Open tab...");
! minfo.wID = TABLINE_MENU_OPEN;
! InsertMenuItem(tab_pmenu, TABLINE_MENU_OPEN, FALSE, &minfo);
GetCursorPos(&pt);
rval = TrackPopupMenuEx(tab_pmenu, TPM_RETURNCMD, pt.x, pt.y, s_tabhwnd,
--- 2283,2292 ----
if (tab_pmenu == NULL)
return;
! add_tabline_popup_menu_entry(tab_pmenu, TABLINE_MENU_CLOSE, _("Close tab"));
! add_tabline_popup_menu_entry(tab_pmenu, TABLINE_MENU_NEW, _("New tab"));
! add_tabline_popup_menu_entry(tab_pmenu, TABLINE_MENU_OPEN,
! _("Open tab..."));
GetCursorPos(&pt);
rval = TrackPopupMenuEx(tab_pmenu, TPM_RETURNCMD, pt.x, pt.y, s_tabhwnd,
--- End Message ---