[xpcom] Fix string handling in getJSValueFromIter()
authorKalle Vahlman <kalle.vahlman@movial.com>
Thu, 16 Apr 2009 08:53:57 +0000 (11:53 +0300)
committerKalle Vahlman <kalle.vahlman@movial.com>
Thu, 16 Apr 2009 08:53:57 +0000 (11:53 +0300)
xpcom-dbusservice/DBusMarshaling.cpp

index ff7d4cc542ee09b53e5a60cfe43014acf0b50f00..cfb66453a837333ca693323cbea3008269d21791 100644 (file)
@@ -906,7 +906,8 @@ void getJSValueFromIter(JSContext* cx, DBusMessageIter *aIter, int aDBusType, js
             dbus_message_iter_get_basic(aIter, &val);
             if (val != nsnull)
             {
-                JSString *str = JS_NewStringCopyN(cx, val, strlen(val));
+                nsAutoString uval = NS_ConvertUTF8toUTF16(val);
+                JSString *str = JS_NewUCStringCopyN(cx, uval.get(), uval.Length());
                 *v = STRING_TO_JSVAL(str);
             }
             break;