Force device name to UTF-8 in legacy Mac OS X target.
authorRyan C. Gordon <icculus@icculus.org>
Fri, 08 Jul 2011 23:44:26 -0700
changeset 108 37a5c255275a
parent 107 7a5feffe807b
child 109 0be531a99f9e
Force device name to UTF-8 in legacy Mac OS X target.

We expect these strings to be UTF-8 when reported to the app, and I've got
a device here that's coming up with Unicode characters in it.

This already uses UTF-8 in the Mac OS X 10.5+ target, this was just a leftover
from the cut-and-pasted HUD Utilities code.
macosx_hidutilities.c
--- a/macosx_hidutilities.c	Fri Jul 08 23:39:43 2011 -0700
+++ b/macosx_hidutilities.c	Fri Jul 08 23:44:26 2011 -0700
@@ -581,7 +581,9 @@
                 refCF = CFDictionaryGetValue (usbProperties, CFSTR("USB Product Name"));
             if (refCF)
             {
-                if (!CFStringGetCString (refCF, pDevice->product, 256, CFStringGetSystemEncoding ()))
+                // ryan forced this to UTF-8.
+                //if (!CFStringGetCString (refCF, pDevice->product, 256, CFStringGetSystemEncoding ()))
+                if (!CFStringGetCString (refCF, pDevice->product, 256, kCFStringEncodingUTF8))
                     HIDReportError ("CFStringGetCString error retrieving pDevice->product.");
             }