tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Tim-Christian Mundt <>
Subject Re: another UTF-8 problem
Date Thu, 26 Aug 2010 12:51:52 GMT
Thanks for your responses. The problem was not the response from the web 
service. Something must have been completely mixed up. I set the Java 
option -Dfile.encoding to utf-8 which solved the write to file problem 
and also put this in the code:

if (req.getCharacterEncoding() == null)
res.setContentType("text/html; charset=UTF-8");

Which solved the encoding of the response I got from the servlet.


Christopher Schultz schrieb:
> Hash: SHA1
> Tim,
> On 8/24/2010 9:06 AM, Tim-Christian Mundt wrote:
>> I've encountered a UTF-8 problem and yes, URIEncoding="UTF-8" is set.
> If you're connecting-out to a SOAP service, then the URIEncoding setting
> doesn't matter.
>> I'm connecting to a web service which returns UTF-8 encoded data. If I
>> do so from a plain, regular, self-contained Java application everything
>> is fine. However, if I run the same classes in tomcat (and trigger the
>> action with a http request instead of a main() method in the
>> application) I get latin-1 encoded characters. For instance when I make
>> a call and receive a response which contains "Łódź" I finally get "?ód?"
>> (console, file, whatever output).
> Are you sure it isn't the encoding to your console/file/whatever that
> isn't set properly?
> If you are getting a response that contains non-ASCII characters, they
> ought to be encoded using the declared XML document's encoding. What is
> that? Are the bytes correct in the response (before your SOAP client
> parses them)? Does your SOAP client parse them correctly? You may have
> to use a profiler to verify that the characters in memory are what you
> expect them to be.
>> Actually the URIEncoding option should not have anything to do with
>> this, because I'm not sending a request to my application, but my
>> application is issuing a SOAP call to a web service. Are there any other
>> options to consider? Same response from the web service (checked with
>> Wireshark) but different outputs. I've no idea. Any hint is welcome.
> So, when you use your own command-line app as a client, you get a
> different response from the SOAP server than when you use Tomcat as the
> client? You should look at the requests that are being sent. Perhaps
> there is a bad accept-charset header or something (although that
> probably shouldn't affect the XML response, since an XML parser is
> pretty much required to support UTF-8).
> - -chris
> Version: GnuPG v1.4.10 (MingW32)
> Comment: Using GnuPG with Mozilla -
> sYsAn3PNB9UqJDunLDeMyQrz6a3Edbao
> =/0N2
> ---------------------------------------------------------------------
> To unsubscribe, e-mail:
> For additional commands, e-mail:

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message