Why does the following code make my Android App crashing?
new String("é".getBytes(StandardCharsets.UTF_8), "UTF8")
or simply
new String("é".getBytes())
How to do this?
Some infos:
- "é" is byte (195 169) is (U+00E9) (Found here: http://www.utf8-chartable.de/unicode-utf8-table.pl?utf8=dec)
- byte in java is always signed, so (195 169) is (-61 -87) (Info: Convert unsigned byte to signed byte)
- I am using Android 6.0.1 CM 13.0-20160813 NIGHTLY on my OnePlus One. It crashed instantly. Even if I enter it in the Android Studio debugger.
- It does not work if I use "StandardCharsets.UTF_8"
Error:
08-18 20:30:04.877 18914-18924/com.nextwebart.senego W/google-breakpad: ### ### ### ### ### ### ### ### ### ### ### ### ### 08-18 20:30:04.877 18914-18924/com.nextwebart.senego W/google-breakpad: Chrome build fingerprint: 08-18 20:30:04.877 18914-18924/com.nextwebart.senego W/google-breakpad: 4.2.8 08-18 20:30:04.877 18914-18924/com.nextwebart.senego W/google-breakpad: 70 08-18 20:30:04.877 18914-18924/com.nextwebart.senego W/google-breakpad: ### ### ### ### ### ### ### ### ### ### ### ### ### 08-18 20:30:04.877 18914-18924/com.nextwebart.senego A/libc: Fatal signal 11 (SIGSEGV), code 1, fault addr 0x5 in tid 18924 (JDWP)
Related question found here: Java Strings Character Encoding - For French - Dutch Locales
------- EDIT:
It happens only in my Android Studio debugger! So when I use this as watch or "evaluate expression". But when I do this in the code and then Log.d(...) it works fine!!! Android Studio 2.1.3
I created an Android Studio Issue for that: https://code.google.com/p/android/issues/detail?id=220366