UTF-8 issues when deploying as a WAR or running under Tomcat
In my grails application, UTF-8 handling is screwed up when I run under Tomcat as a war. When I do run app, the following request string of:
utf-8-demo-%C3%BC%C4%81%D1%84.txt
is set to utf-8-demo-üāф.txt
, with 3 unicode escape sequences sent back for each of the unic开发者_如何学Pythonode characters in the string for all subsequent requests.
Under tomcat, this comes back as utf-8-demo-üÄÑ.txt
, or utf-8-demo-\u00C3\u00BC\u00C4\u0081\u00D1\u0084.txt
.
In one of my controllers, I have this:
String s = params.file
log.info( "Filename: $s" )//works in run-app, fails under tomcat
What could POSSIBLY be causing this behavior dichotomy between run-app and deploying as a war under tomcat?
Add the attribute URIEncoding="UTF-8"
on the <Connector>
definition in server.xml
.
精彩评论