diff options
| -rw-r--r-- | ChangeLog | 6 | ||||
| -rw-r--r-- | win32/gui/WndMain.c | 11 | ||||
| -rw-r--r-- | win32/intl/gettext.c | 19 |
3 files changed, 33 insertions, 3 deletions
@@ -1,3 +1,9 @@ +May 24, 2010 Wei Mingzhi <whistler_wmz@users.sf.net> + + * win32/gui/WndMain.c: Also show Japanese titles properly for Windows + (need to set ACP to east-asian languages). + * win32/intl/gettext.c: Added a hack for UTF-8 support. + May 23, 2010 Wei Mingzhi <whistler_wmz@users.sf.net> * AUTHORS: Updated info. diff --git a/win32/gui/WndMain.c b/win32/gui/WndMain.c index 3cbc88d5..c48f34ce 100644 --- a/win32/gui/WndMain.c +++ b/win32/gui/WndMain.c @@ -843,14 +843,21 @@ void UpdateMcdItems(int mcd, int idc) { void McdListGetDispInfo(int mcd, int idc, LPNMHDR pnmh) {
LV_DISPINFO *lpdi = (LV_DISPINFO *)pnmh;
McdBlock *Info;
+ char buf[256], buftitle[256];
- Info = &Blocks[mcd-1][lpdi->item.iItem];
+ Info = &Blocks[mcd - 1][lpdi->item.iItem];
switch (lpdi->item.iSubItem) {
case 0:
switch (Info->Flags & 0xF) {
case 1:
- lpdi->item.pszText = Info->Title;
+ if (MultiByteToWideChar(932, 0, (LPCSTR)Info->sTitle, -1, (LPWSTR)buf, sizeof(buf)) == 0) {
+ lpdi->item.pszText = Info->Title;
+ } else if (WideCharToMultiByte(CP_ACP, 0, (LPCWSTR)buf, -1, (LPSTR)buftitle, sizeof(buftitle), NULL, NULL) == 0) {
+ lpdi->item.pszText = Info->Title;
+ } else {
+ lpdi->item.pszText = buftitle;
+ }
break;
case 2:
lpdi->item.pszText = _("mid link block");
diff --git a/win32/intl/gettext.c b/win32/intl/gettext.c index b0f69a7b..18b3d81d 100644 --- a/win32/intl/gettext.c +++ b/win32/intl/gettext.c @@ -52,6 +52,8 @@ # define DGETTEXT dgettext__ #endif +#include <windows.h> // Added by Wei Mingzhi 5-4-2010 + /* Look up MSGID in the current default message catalog for the current LC_MESSAGES locale. If not found, returns MSGID itself (the default text). */ @@ -59,7 +61,22 @@ char * GETTEXT (msgid) const char *msgid; { - return DGETTEXT (NULL, msgid); +// return DGETTEXT (NULL, msgid); + + // 5-24-2010 Wei Mingzhi + // Hack for UTF-8 support + char *t = DGETTEXT(NULL, msgid); + static char buf[16384], bufout[16384]; + + if (MultiByteToWideChar(CP_UTF8, 0, (LPCSTR)t, -1, (LPWSTR)buf, sizeof(buf)) == 0) { + return t; + } + + if (WideCharToMultiByte(CP_ACP, 0, (LPCWSTR)buf, -1, (LPSTR)bufout, sizeof(bufout), NULL, NULL) == 0) { + return t; + } + + return bufout; } #ifdef _LIBC |
