You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@velocity.apache.org by Sam Joseph <ga...@yha.att.ne.jp> on 2002/11/29 06:04:06 UTC

Japanese characters in Velocity Context

Hi All,

I've generally had success with getting Velocity to print out Japanese 
characters when they appear in velocity templates, however recently when 
trying to place japanese characters in a Velocity context for use in 
adding data to a template, I have not been so fortunate.

I have tried various combinations of input.enoding and output.encoding 
trying UTF8, Shift_JIS and MS932.

Not of the Japanese characters added through the context have come out 
(I get just ????), and the japanese characters in the templates 
themselves only appear legibly when I leave out both input and output 
encodings, or set the output encoding to Shift_JIS.  Any other setting 
causes both the context based Japanese characters and the template based 
Japanese characters to become series of question marks.

I should also mention that I am using velocity as part of the turbine tdk.

If anybody has any insight about how I can pass Japanese characters 
through the velocity context I would be very grateful.

CHEERS> SAM



--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: Japanese characters in Velocity Context

Posted by Sam Joseph <ga...@yha.att.ne.jp>.
Well, I seem to have solved the problem already; sorry to have bothered 
you all.

I managed to find some older posts of mine on the list when I was having 
a similar problem with displaying Japanese characters that I had taken 
from a database (in this instance I was just taking them as java variables).

Anyway, so to try and experiment I did this:

 context.put("ACCOUNT_STATUS",new 
String(ACCOUNT_STATUS_JAP.getBytes("Shift_JIS"), "8859_1"));

and now they display just fine,

Again this seems to operate independently of setting the output 
encoding, but then I am using a Japanese operating system, so the 
default output encoding is probably Shift_JIS.

CHEERS> SAM

Sam Joseph wrote:

> Hi All,
>
> I've generally had success with getting Velocity to print out Japanese 
> characters when they appear in velocity templates, however recently 
> when trying to place japanese characters in a Velocity context for use 
> in adding data to a template, I have not been so fortunate.
>
> I have tried various combinations of input.enoding and output.encoding 
> trying UTF8, Shift_JIS and MS932.
>
> Not of the Japanese characters added through the context have come out 
> (I get just ????), and the japanese characters in the templates 
> themselves only appear legibly when I leave out both input and output 
> encodings, or set the output encoding to Shift_JIS.  Any other setting 
> causes both the context based Japanese characters and the template 
> based Japanese characters to become series of question marks.
>
> I should also mention that I am using velocity as part of the turbine 
> tdk.
>
> If anybody has any insight about how I can pass Japanese characters 
> through the velocity context I would be very grateful.
>
> CHEERS> SAM
>
>
>
> -- 
> To unsubscribe, e-mail:   
> <ma...@jakarta.apache.org>
> For additional commands, e-mail: 
> <ma...@jakarta.apache.org>
>
>
>




--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>