Two massive steps toward making Java servlets do the right thing with

non-English languages. UTF-8 is my friend.


git-svn-id: https://samskivert.googlecode.com/svn/trunk@1418 6335cc39-0255-0410-8fd6-9bcaacd3b74c
This commit is contained in:
mdb
2004-04-26 08:47:59 +00:00
parent c091f63098
commit 21b4f70b61
@@ -1,5 +1,5 @@
//
// $Id: DispatcherServlet.java,v 1.23 2004/02/25 13:16:32 mdb Exp $
// $Id: DispatcherServlet.java,v 1.24 2004/04/26 08:47:59 mdb Exp $
//
// samskivert library - useful routines for java programs
// Copyright (C) 2001 Michael Bayne
@@ -262,8 +262,15 @@ public class DispatcherServlet extends VelocityServlet
// then select the template
Template tmpl = selectTemplate(siteId, ictx);
// assume an HTML response unless otherwise massaged by the logic
rsp.setContentType("text/html");
// assume the request is in UTF-8 format unless it has actually
// been sensibly parsed by the browser
if (req.getCharacterEncoding() == null) {
req.setCharacterEncoding("UTF-8");
}
// assume an HTML response in the UTF-8 character set unless
// otherwise massaged by the logic
rsp.setContentType("text/html; charset=UTF-8");
try {
// insert the application into the context in case the