velocity-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Jeff Schnitzer" <j...@infohazard.org>
Subject RE: Character encoding
Date Thu, 08 Nov 2001 23:36:23 GMT
There are a couple places that the problem could be occurring, none of
which have much to do with Velocity.  I'll offer a likely suggestion,
though:

It's a common problem to be decoding the form submission using the wrong
character encoding.  In general, browsers encode submissions using the
same charset used to encode the document which contains the form.
However, this bit of information (the encoding charset) is *not* sent
along with the HTTP request, so the server has to guess at what charset
to use to decode the submission.

In fact, that "guess" usually (for Tomcat and Orion, at least) means
that web containers default to ISO-8859-1 unless your servlet
specifically calls HttpServletRequest.setCharacterEncoding() *before*
any data is read, including accessing any of the parameters.  Some web
containers offer other strategies (like guessing based on the user's
locale, which *is* submitted), but they all have serious problems (like
does jp mean Kanji or UTF-8?).

My advice is to pick a charset that accommodates all your languages and
then stick to it religiously.  UTF-8 is fine.  If you aren't worried
about localizing outside of the western world, ISO-8859-1 is by far the
easiest.

The problem then becomes a) making sure that your content is sent in
your chosen charset, and b) making sure that requests are interpreted in
your chosen charset.  If you aren't going to use ISO-8859-1, both of
these will require some sort of configuration in Turbine.  I could tell
you how to do it in Maverick, but that won't help you :-)

Of course, the your problem could be something completely different
(like something getting translated when written to and read from your
database), in which case this message was almost entirely pointless :-)
Check the data in your database; if it's wrong, chances are the problem
is a discrepancy between your "output" and "input" charsets.

Good luck,
Jeff Schnitzer
jeff@infohazard.org
The Maverick MVC Framework:  http://mav.sourceforge.net

> -----Original Message-----
> From: Eric Daras [mailto:eric.daras@dafriser.be]
> Sent: Thursday, November 08, 2001 1:22 PM
> To: velocity-user@jakarta.apache.org
> Subject: Character encoding
> 
> Bonjour,
> 
> I'm using velocity with Turbine for one week but i get some problems
> with character encoding.  I'm french !!!  The problem append when I
want
> to send information from a form into the db.  When I want to get
> information after that, the characters like "é" or "è"  changed into
"È"
> and "Ë".  I don't know if the problem comes from Velocity or Turbine
!!!
> 
> Excuse the bad English

--
To unsubscribe, e-mail:   <mailto:velocity-user-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:velocity-user-help@jakarta.apache.org>


Mime
View raw message