[prev in list] [next in list] [prev in thread] [next in thread] 

List:       velocity-user
Subject:    Multiple charset encoding
From:       Normand Gagnon <ngagnon () newtradetech ! com>
Date:       2002-01-29 20:08:09
[Download RAW message or body]

I'm using velocity-1.2-rc3 and I'm getting a bit confuse with the character 
encoding.  Where should I specify the charset?

In the servlet with:

response.setContentType( "text/html;charset=Shift_JIS" );

or/and

in the html header page with:

<meta http-equiv="Content-Type" content="text/html; charset=Shift_JIS">

(By the way, are this two lines equivalent?, I mean, do the same thing to 
the page?)

or/and

when I get the template from the VelocityServlet with method:

outty =  getTemplate(responseTemplate,"Shift_JIS");    <---(is this used 
for input encoding or output encoding?)

or/and

in the velocity.properties file with:

#----------------------------------------------------------------------------
# T E M P L A T E  E N C O D I N G
#----------------------------------------------------------------------------

input.encoding=ISO-8859-1
output.encoding=Shift_JIS

...

I say "or/and" because I don't know if I need to use them all.

Using all or a combination of these methods produced these results:

With the response.setContentType() or the html tag <meta> I got Japanese 
characters from a resource bundle property file displayed properly but the 
method japanLocale.getDisplayLanguage(japanLocale) returns three ("???") 
question marks (should be the string "japanese" in japanese language)

Setting the template encoding in the Velocity.properties file makes the 
method japanLocale.getDisplayLanguage(japanLocale) works but the Japanese 
resource bundle does not work anymore ( I got garbage)... Maybe it is 
because my Japanese properties file are not encoding properly, but I'm not 
sure since it works when the template encoding is set to ISO-8859-1...

My main concern is if we have to set the template encoding in the 
velocity.properties file, how do we deal with multiple languages and 
multiple charset? Isn't what the method "outty 
=  getTemplate(responseTemplate,"Shift_JIS"); " was intended for?  I don't 
really know the behavior of this method.

Thank you, and sorry for my poor english :)





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

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic