Created
December 29, 2014 17:46
-
-
Save Gazer/c0c002c25b1fc302674c to your computer and use it in GitHub Desktop.
Charset name problem
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Log.d("Charset", "toString() : " + CharsetToolkit.getDefaultSystemCharset().toString()); | |
Log.d("Charset", "displayName() : " + CharsetToolkit.getDefaultSystemCharset().displayName()); | |
Log.d("Charset", "name() : " + CharsetToolkit.getDefaultSystemCharset().name()); | |
Output : | |
D/Charset﹕ toString() : java.nio.charset.CharsetICU[UTF-8] | |
D/Charset﹕ displayName() : UTF-8 | |
D/Charset﹕ name() : UTF-8 | |
Then : | |
new URL('http://google.com').text fails with | |
Caused by: java.nio.charset.IllegalCharsetNameException: java.nio.charset.CharsetICU[UTF-8] | |
at java.nio.charset.Charset.checkCharsetName(Charset.java:201) | |
at java.nio.charset.Charset.forName(Charset.java:295) | |
at java.io.InputStreamReader.<init>(InputStreamReader.java:85) | |
at org.codehaus.groovy.runtime.ResourceGroovyMethods.newReader(ResourceGroovyMethods.java:2064) | |
new URL('http://google.com').getText("utf-8") works ok. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment