UTF-8 via SOAP
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-19-2010 07:36 AM
Hi,
I'm using the alfresco web services and have the problem that I don't get UTF-8 encoded text. For instance when I create a file with the name "Łódź.txt" in the alfresco webclient it is displayed correctly (database and connection are properly configured) but the Java webservice client returns "?ód?.txt" as name. The PHP webservice client gets it right.
I had a look at the SOAP response with Wireshark and it showed that "Ł", "ó" and "ź" are encoded as "&#<unicodeCodePoint>;" (e.g.  for Ł). Hence, the problem is not the encoding of the response itself but there must be some decoding on the client side which for some reason produces Latin-1 instead of UTF-8.
How can I make axis or the alfresco webclient to give me UTF-8 encoded text?
Thanks
Tim
I'm using the alfresco web services and have the problem that I don't get UTF-8 encoded text. For instance when I create a file with the name "Łódź.txt" in the alfresco webclient it is displayed correctly (database and connection are properly configured) but the Java webservice client returns "?ód?.txt" as name. The PHP webservice client gets it right.
I had a look at the SOAP response with Wireshark and it showed that "Ł", "ó" and "ź" are encoded as "&#<unicodeCodePoint>;" (e.g.  for Ł). Hence, the problem is not the encoding of the response itself but there must be some decoding on the client side which for some reason produces Latin-1 instead of UTF-8.
How can I make axis or the alfresco webclient to give me UTF-8 encoded text?
Thanks
Tim
Labels:
- Labels:
-
Archive
1 REPLY 1
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-01-2010 08:51 AM
Well, this was neither an axis problem nor an alfresco one. Tomcat for some reason uses latin-1 as default encoding for responses and writing to file (two separate problems actually, which appeared to be connected). I fixed it by setting the Java option -Dfile.encoding=utf-8 and putting this in the code:
if (req.getCharacterEncoding() == null)
req.setCharacterEncoding("UTF-8");
res.setContentType("text/html; charset=UTF-8");
res.setCharacterEncoding("UTF-8");
Cheers
Tim
if (req.getCharacterEncoding() == null)
req.setCharacterEncoding("UTF-8");
res.setContentType("text/html; charset=UTF-8");
res.setCharacterEncoding("UTF-8");
Cheers
Tim
