From a2df25cedab001935f81b2092aa669c005a0bab1 Mon Sep 17 00:00:00 2001 From: "Ryan C. Gordon" Date: Fri, 8 Jul 2011 23:44:26 -0700 Subject: [PATCH] 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 | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/macosx_hidutilities.c b/macosx_hidutilities.c index 41c7268..bc0bfe4 100644 --- a/macosx_hidutilities.c +++ b/macosx_hidutilities.c @@ -581,7 +581,9 @@ static void hid_GetDeviceInfo (io_object_t hidDevice, CFMutableDictionaryRef hid 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."); }