Details
-
Bug
-
Status: Closed
-
Minor
-
Resolution: Fixed
-
2.4.0-beta-3, 2.4.0-beta-4
-
None
-
Android 4.4.4, groovy:2.4.0-beta-4
Description
Trying to use 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)
On Android, the Charset#toString prepend the class name on the returned string and thats break Charset.fromName used later to create the reader.
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
This was tested on Android 4.4.4.