diff src/macmenu.c @ 58752:4ad0594e1ac4

* macterm.h (cfstring_create_with_utf8_cstring): Added prototype. * image.c (image_load_quartz2d): Use cfstring_create_with_utf8_cstring * macmenu.c (add_menu_item): Use cfstring_create_with_utf8_cstring * macfns.c (x_set_name, x_set_title): Use cfstring_create_with_utf8_cstring (Fx_file_dialog): Use cfstring_create_with_utf8_cstring and use constant CFRefs instead of creating them each time for labels. * mac.c (cfstring_create_with_utf8_cstring): Added to prevent crashes with invalid characters.
author Steven Tamm <steventamm@mac.com>
date Fri, 03 Dec 2004 17:00:11 +0000
parents 60340bd28043
children c4138f578114 f2ebccfa87d4
line wrap: on
line diff
--- a/src/macmenu.c	Fri Dec 03 11:30:11 2004 +0000
+++ b/src/macmenu.c	Fri Dec 03 17:00:11 2004 +0000
@@ -2264,17 +2264,8 @@
       item_name[255] = 0;
 #if TARGET_API_MAC_CARBON
       {
-	CFStringRef string =
-	  CFStringCreateWithCString (NULL, item_name, kCFStringEncodingUTF8);
+	CFStringRef string = cfstring_create_with_utf8_cstring (item_name);
 
- 	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);
       }