From 9ee5e7e17f7d65620f21d1a42865981e7bc56593 Mon Sep 17 00:00:00 2001 From: Mike Lockwood Date: Mon, 8 Sep 2014 16:15:21 -0700 Subject: USB string descriptors are not UTF8, so it is not safe to treat them as such. Add AndroidRuntime::NewStringLatin1() to convert non-UTF8 strings to Java strings. Bug: 17427781 Change-Id: I7df1d4e94a7beebc8b1a74c0c0a163b794025ae8 --- include/android_runtime/AndroidRuntime.h | 3 +++ 1 file changed, 3 insertions(+) (limited to 'include/android_runtime') diff --git a/include/android_runtime/AndroidRuntime.h b/include/android_runtime/AndroidRuntime.h index 51e47e6..a882870 100644 --- a/include/android_runtime/AndroidRuntime.h +++ b/include/android_runtime/AndroidRuntime.h @@ -114,6 +114,9 @@ public: /** return a new string corresponding to 'className' with all '.'s replaced by '/'s. */ static char* toSlashClassName(const char* className); + /** Create a Java string from an ASCII or Latin-1 string */ + static jstring NewStringLatin1(JNIEnv* env, const char* bytes); + private: static int startReg(JNIEnv* env); void addOption(const char* optionString, void* extra_info = NULL); -- cgit v1.1