You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@velocity.apache.org by "Desai, Sanket (HBO)" <Sa...@hbo.com> on 2006/08/16 23:47:18 UTC
Need help displaying Korean characters in velocity template
Hi there,
I wish to display Korean characters in a velocity template.
As per velocity mailing list on web, I've set following in
velocity.properties file:
input.encoding=UTF-8
In java code, I can see that the strings are actual Korean characters as
entered in database table.
So for a test I do the following for velocity template:
context.put("koreanString", new
String("some_korean_string".getBytes("Shift_JIS"), "8859_1"));
above piece of code actually works for Japanese characters but I didn't
find an equivalent for Korean characters.
So in the velocity template, I've following to display the Korean
string:
<synopsis><![CDATA[$koreanString]]></synopsis>
I also tried the following:
<synopsis><![CDATA[\u$koreanString]]></synopsis>
But it didn't work.
Would anyone know a way to display Korean characters in Velocity
template?
Regards,
Sanket Desai
==============================================================================
This e-mail is intended only for the use of the addressees. Any copying, forwarding, printing or other use of this e-mail by persons other than the addressees is not authorized. This e-mail may contain information that is privileged, confidential and exempt from disclosure. If you are not the intended recipient, please notify us immediately by return e-mail (including the original message in your reply) and then delete and discard all copies of the e-mail. Thank you.
Re: Need help displaying Korean characters in velocity template
Posted by mailmur <ma...@yahoo.com>.
UnicodeFileResourceLoader:
http://koti.mbnet.fi/akini/java/unicodereader/
You could try using UnicodeFileResourceLoader and
always save your .vm templates as UTF-8 files.
Actually you should use UTF-8 with bom marker format.
It is what windows Notepad does when saving utf8
files.
Or you may use UTF-16BE or UTF-16LE charset formats as
well. Notepad does both as well.
Using unicodeloader you dont need to worry about
input.encoding params. I think it is more or less
obsolete param, works only in VelocityServlet. Its not
actually being used by the Velocity _engine_ itself,
very misleading param.
--- "Desai, Sanket (HBO)" <Sa...@hbo.com>
wrote:
> Hi there,
>
> I wish to display Korean characters in a velocity
> template.
>
> As per velocity mailing list on web, I've set
> following in
> velocity.properties file:
>
> input.encoding=UTF-8
>
> In java code, I can see that the strings are actual
> Korean characters as
> entered in database table.
>
> So for a test I do the following for velocity
> template:
>
> context.put("koreanString", new
> String("some_korean_string".getBytes("Shift_JIS"),
> "8859_1"));
>
> above piece of code actually works for Japanese
> characters but I didn't
> find an equivalent for Korean characters.
>
> So in the velocity template, I've following to
> display the Korean
> string:
>
> <synopsis><![CDATA[$koreanString]]></synopsis>
>
> I also tried the following:
>
> <synopsis><![CDATA[\u$koreanString]]></synopsis>
>
> But it didn't work.
>
>
>
> Would anyone know a way to display Korean characters
> in Velocity
> template?
>
>
>
>
>
> Regards,
>
> Sanket Desai
>
>
>
>
>
==============================================================================
> This e-mail is intended only for the use of the
> addressees. Any copying, forwarding, printing or
> other use of this e-mail by persons other than the
> addressees is not authorized. This e-mail may
> contain information that is privileged, confidential
> and exempt from disclosure. If you are not the
> intended recipient, please notify us immediately by
> return e-mail (including the original message in
> your reply) and then delete and discard all copies
> of the e-mail. Thank you.
>
>
__________________________________________________
Do You Yahoo!?
Tired of spam? Yahoo! Mail has the best spam protection around
http://mail.yahoo.com
---------------------------------------------------------------------
To unsubscribe, e-mail: velocity-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: velocity-user-help@jakarta.apache.org