changeset 58708:60340bd28043

* macmenu.c (add_menu_item): Fallback on MacRoman if encoding menu text as UTF8 fails.
author Steven Tamm <steventamm@mac.com>
date Wed, 01 Dec 2004 15:51:22 +0000
parents 57741ce4cd6b
children 2448f32821a6
files src/ChangeLog src/macmenu.c
diffstat 2 files changed, 13 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/src/ChangeLog	Wed Dec 01 14:10:23 2004 +0000
+++ b/src/ChangeLog	Wed Dec 01 15:51:22 2004 +0000
@@ -1,3 +1,8 @@
+2004-12-01  YAMAMOTO Mitsuharu  <mituharu@math.s.chiba-u.ac.jp>
+
+	* macmenu.c (add_menu_item): Fallback on MacRoman if encoding
+	menu text as UTF8 fails.
+
 2004-12-01  Kim F. Storm  <storm@cua.dk>
 
 	* alloc.c: Add commentary for last change.
--- a/src/macmenu.c	Wed Dec 01 14:10:23 2004 +0000
+++ b/src/macmenu.c	Wed Dec 01 15:51:22 2004 +0000
@@ -2267,6 +2267,14 @@
 	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);
       }