From: Steven Tamm Date: Wed, 1 Dec 2004 15:51:22 +0000 (+0000) Subject: * macmenu.c (add_menu_item): Fallback on MacRoman if encoding X-Git-Tag: ttn-vms-21-2-B4~3487 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=f86bdc80c496aee7c29675f05d3690cf2c128091;p=emacs.git * macmenu.c (add_menu_item): Fallback on MacRoman if encoding menu text as UTF8 fails. --- diff --git a/src/ChangeLog b/src/ChangeLog index 0eca89ab0c6..2faf38841aa 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,8 @@ +2004-12-01 YAMAMOTO Mitsuharu + + * macmenu.c (add_menu_item): Fallback on MacRoman if encoding + menu text as UTF8 fails. + 2004-12-01 Kim F. Storm * alloc.c: Add commentary for last change. diff --git a/src/macmenu.c b/src/macmenu.c index 007fab15eab..af24cfe237c 100644 --- a/src/macmenu.c +++ b/src/macmenu.c @@ -2267,6 +2267,14 @@ add_menu_item (MenuHandle menu, widget_value *wv, int submenu, CFStringRef string = CFStringCreateWithCString (NULL, item_name, kCFStringEncodingUTF8); + if (string == NULL) + { + /* Failed to interpret as UTF8. Fall back to Mac Roman. + Maybe wv->name is corrupted? */ + string = CFStringCreateWithCString (NULL, item_name, + kCFStringEncodingMacRoman); + } + SetMenuItemTextWithCFString (menu, pos, string); CFRelease (string); }