Writing strings with umlauts is ok, but reading umlauts will result in wrong encoding.
This is an issue mainly in windows enviroments. Because the default encoding of the jvm is there cp1252. But for json it must be UTF-8.
Solving this issue is simple:
Just set encodig to "UTF-8" of the InputStreamReader in the get method in the CouchDbClientBase.java.
/**
* Performs a HTTP GET request.
* @return An object of type T
*/
<T> T get(URI uri, Class<T> classType) {
InputStream in = null;
try {
in = get(uri);
return getGson().fromJson(new InputStreamReader(in, "UTF-8"), classType);
} catch (UnsupportedEncodingException e) {
e.printStackTrace();
} finally {
close(in);
}
return null;
}
Writing strings with umlauts is ok, but reading umlauts will result in wrong encoding. This is an issue mainly in windows enviroments. Because the default encoding of the jvm is there cp1252. But for json it must be UTF-8. Solving this issue is simple: Just set encodig to "UTF-8" of the InputStreamReader in the get method in the CouchDbClientBase.java.