You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Petr Nemecek <pn...@cmail.cz> on 2014/04/15 22:14:25 UTC

Tomcat @ Windows & Cyrillic

Hi all,

I need to use cyrillic in my webapp.

What I did:
* Added -Dfile.encoding=utf-8 to the Java options
* Added URIEncoding="UTF-8" to the connector in server.xml

What I achieved:
* When I send a request with cyrillic chars to the Tomcat, it's properly
received.
* When I send response with cyrillic chars out of the Tomcat, it's properly
sent.

What I did not achieved (and asking you kindly for help):
* When my webapp, sitting in the Tomcat, sends a request containing cyrillic
chars, these don't go out. So when I try to send out e.g.
"PrahaСимферополь", just "Praha" goes out. By sending out I mean calling cxf
web service. When I call that webservice directly (from jar, not from
Tomcat), everything works fine.

Any idea?

Many thanks,
 Petr

P.S. Tomcat 7.0.53, Windows Server 2012 R2.


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Re: Tomcat @ Windows & Cyrillic

Posted by Christopher Schultz <ch...@christopherschultz.net>.
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA256

André,

On 4/15/14, 4:41 PM, André Warnier wrote:
> Petr Nemecek wrote:
>> Hi all,
>> 
>> I need to use cyrillic in my webapp.
>> 
>> What I did: * Added -Dfile.encoding=utf-8 to the Java options *
>> Added URIEncoding="UTF-8" to the connector in server.xml
>> 
>> What I achieved: * When I send a request with cyrillic chars to
>> the Tomcat, it's properly received. * When I send response with
>> cyrillic chars out of the Tomcat, it's properly sent.
>> 
>> What I did not achieved (and asking you kindly for help): * When
>> my webapp, sitting in the Tomcat, sends a request containing 
>> cyrillic chars, these don't go out. So when I try to send out
>> e.g. "PrahaСимферополь", just "Praha" goes out. By sending out I
>> mean calling cxf web service. When I call that webservice
>> directly (from jar, not from Tomcat), everything works fine.
>> 
>> Any idea?
>> 
> 
> When an application (running under tomcat or not) "sends a request"
> to some external service, it uses some code to do that, which is
> not part of the tomcat code. Which code/library are you using for
> that ?

+1

Most libraries have a way to set the character encoding used for
everything. Generally speaking, I would avoid using non-US-ACSII in
URLs because not all servers behave the way you'd expect. If you send
the data in a request body with a proper Content-Type header,
everything should be fine.

- -chris
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1
Comment: GPGTools - http://gpgtools.org
Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/

iQIcBAEBCAAGBQJTUEwRAAoJEBzwKT+lPKRYqrYP/1endxLrASJZ2tKvRhOFDm6A
v4EOCTBoNvoAwxUybLZ4Nz8JR2EG21ihycA+p3nWeTT8ZHWY4po3bFClt0s9gqab
RhjHxqU1WZbR8ZCZh5LQLsuvHFfsaMqc/HerJ2QNkqh2lpK45Z2TNT8wvBmYAvN2
tuvTwSYd/Yc+j/ZGRQq02pPC2nPuPQLWVUNvAWuQaJ6HO6CTndEp+YPXyrxbQWEe
/urG9wVsE57C0pataraOhgTqlR+Buysbx187RANI7msJ89W5qQsdhSkrhMegwrRQ
NsY5oz3W6d4ekt8vZBMEaVUhKd6682I8fKfbvCQ+VQclH6DLfChKDyazVHNWbkv7
5Fqw8zDRofkEDAaZGjEMyuYXKVjeS1ItDh2gjGm/aFW4dDpN2pPlV2WxuoakBXFZ
/neQaW8em0yYUrB3fqzL4fajRpjmZyplA/+0Yal1x3XFe4tDpIhEoaQy9Yh2Bu3k
IOzGNmpe0KIfxaLCeE/Elxcs7vC1FsmU8feCBfIJ+vFTqg1OsLySTSM6UKuF3Dqp
LcV2Rt07tM3Q0jtyCMiyWGoxwFougJHo+8RdFrrWse04b/ps4Qgp/kyRJiVoZnSj
kKqPd3AXjzyfWKw/tDu1ndZRMeBW/0R8y6DW7GRMRGkS73FRdh9O3oJ7M7C0ITqk
H7yR1WQZuSqRehAIYvTK
=HkN+
-----END PGP SIGNATURE-----

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Re: Tomcat @ Windows & Cyrillic

Posted by André Warnier <aw...@ice-sa.com>.
Petr Nemecek wrote:
> Hi all,
> 
> I need to use cyrillic in my webapp.
> 
> What I did:
> * Added -Dfile.encoding=utf-8 to the Java options
> * Added URIEncoding="UTF-8" to the connector in server.xml
> 
> What I achieved:
> * When I send a request with cyrillic chars to the Tomcat, it's properly
> received.
> * When I send response with cyrillic chars out of the Tomcat, it's properly
> sent.
> 
> What I did not achieved (and asking you kindly for help):
> * When my webapp, sitting in the Tomcat, sends a request containing cyrillic
> chars, these don't go out. So when I try to send out e.g.
> "PrahaСимферополь", just "Praha" goes out. By sending out I mean calling cxf
> web service. When I call that webservice directly (from jar, not from
> Tomcat), everything works fine.
> 
> Any idea?
> 

When an application (running under tomcat or not) "sends a request" to some external 
service, it uses some code to do that, which is not part of the tomcat code.
Which code/library are you using for that ?
In how much could this code/library be influenced by the fact that it is running under the 
JVM which runs Tomcat (and the settings of that Tomcat JVM) ?

More explicitly : a Java application doesn't just "run". It is "being run" by the JVM that 
runs it.  That JVM runs with certain settings (say, "system properties") which influence 
the way in which it runs the applications which it runs.

On thing which has happened to me in the past (and I really don't know if this is still 
applicable) is as follows :
Tomcat starts, under some JVM settings appropriate for your application.
Then it runs various applications, including yours.  One of the other applications, for 
whatever reason of its own, changes a JVM system property. And because this is a 
JVM-global property, this new setting now interferes with your application when it runs.

(And the case of which I am talking, happened to concern some default language setting; 
and this caused my application to suddenly start outputting messages in English instead of 
the expected German).

This would of course not happen, when you run your application stand-alone, because then 
there are no other applications to mess with the JVM system properties.

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org