You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@velocity.apache.org by Rafał Gierusz <ra...@jaworzyna.net> on 2006/02/08 18:32:04 UTC
Re[2]: Messages resources problem...
NB> there are many different places where encoding can be set. what is
NB> the encoding of your *.vm files? in your velocity.properties are you
NB> setting either the input.encoding, output.encoding, or
NB> default.contentType? i think struts might have some places to set
NB> encodings as well.
1) my *.vm file are written in UTF-8 and inside is XHTML with content="text/html; charset=UTF-8"
2) my velocity.properties are set to:
input.encoding=UTF-8
output.encoding=UTF-8
3) my resource file is written using UTF-8
4) my locale is "pl", I set encoding for this locale in web.xml to
UTF-8
5) my HttpRequest charset encoding is set to UTF-8
I've tried everything but I can't get correct text from resources at
*.vm page using MessageTool
--
Rafal
---------------------------------------------------------------------
To unsubscribe, e-mail: velocity-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: velocity-user-help@jakarta.apache.org
Re: Messages resources problem...
Posted by David Sperling <ve...@hakodateit.com>.
Rafał Gierusz wrote:
>I have filter... configured the same way as in your letter... that is
>why I had written that I have request charset encoding set to UTF-8.
>
>Any others ideas? :-)
>
>
>
What output are you getting exactly?
Try testing with a simple vm page like this:
<html>
<body>
<p> Your locale is: $request.locale </p>
<p> this text should be polish: $text.test.polish.sentence
</body>
</html>
Add something like this to your application.properties file:
test.polish.sentence=test polish sentence from the default bundle
Then add something like this to your application_po.properties file
test.polish.sentence=test polish sentence from the polish bundle
What output do you get for the above page?
Cheers,
---------------------------------------------------------------------
To unsubscribe, e-mail: velocity-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: velocity-user-help@jakarta.apache.org
Re: Messages resources problem...
Posted by Magne Skjeret <ma...@broadpark.no>.
Rafał Gierusz skrev:
> I have filter... configured the same way as in your letter... that is
> why I had written that I have request charset encoding set to UTF-8.
>
> Any others ideas? :-)
>
Hi
You say that your properties file is utf-8 encoded?
I think java only reads properties files in iso-8859-1
If you use characters not in iso-8859-1 you need to unicode escape it.
http://java.sun.com/j2se/1.4.2/docs/tooldocs/windows/native2ascii.html
I hope that helps
Magne
---------------------------------------------------------------------
To unsubscribe, e-mail: velocity-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: velocity-user-help@jakarta.apache.org
Re[2]: Messages resources problem...
Posted by Rafał Gierusz <ra...@jaworzyna.net>.
I have filter... configured the same way as in your letter... that is
why I had written that I have request charset encoding set to UTF-8.
Any others ideas? :-)
--
Rafal
DS> A filter should do the trick:
DS> Add this to your web.xml:
DS> <web-app>
DS> <display-name>My App Name</display-name>
DS> <filter>
DS> <filter-name>Set Character Encoding</filter-name>
DS> <filter-class>com.mydomain.myapp.filter.SetCharacterEncodingFilter</filter-class>
DS> <init-param>
DS> <param-name>encoding</param-name>
DS> <param-value>UTF-8</param-value>
DS> </init-param>
DS> </filter>
DS> <filter-mapping>
DS> <filter-name>Set Character Encoding</filter-name>
DS> <url-pattern>/*</url-pattern>
DS> </filter-mapping>
DS> Then add the SetCharacterEncodingFilter class to your web app. The
DS> filter usually ships with Tomcat(if that's what you are using)
DS> I found mine here:
DS> /jakarta-tomcat-5.0.28/webapps/servlets-examples/WEB-INF/classes/filters/SetCharacterEncodingFilter.java
---------------------------------------------------------------------
To unsubscribe, e-mail: velocity-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: velocity-user-help@jakarta.apache.org
Re: Messages resources problem...
Posted by David Sperling <ve...@hakodateit.com>.
A filter should do the trick:
Add this to your web.xml:
<web-app>
<display-name>My App Name</display-name>
<filter>
<filter-name>Set Character Encoding</filter-name>
<filter-class>com.mydomain.myapp.filter.SetCharacterEncodingFilter</filter-class>
<init-param>
<param-name>encoding</param-name>
<param-value>UTF-8</param-value>
</init-param>
</filter>
<filter-mapping>
<filter-name>Set Character Encoding</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
Then add the SetCharacterEncodingFilter class to your web app. The
filter usually ships with Tomcat(if that's what you are using)
I found mine here:
/jakarta-tomcat-5.0.28/webapps/servlets-examples/WEB-INF/classes/filters/SetCharacterEncodingFilter.java
Cheers,
David
Rafał Gierusz wrote:
>NB> there are many different places where encoding can be set. what is
>NB> the encoding of your *.vm files? in your velocity.properties are you
>NB> setting either the input.encoding, output.encoding, or
>NB> default.contentType? i think struts might have some places to set
>NB> encodings as well.
>
>1) my *.vm file are written in UTF-8 and inside is XHTML with content="text/html; charset=UTF-8"
>2) my velocity.properties are set to:
>
>input.encoding=UTF-8
>output.encoding=UTF-8
>
>3) my resource file is written using UTF-8
>4) my locale is "pl", I set encoding for this locale in web.xml to
>UTF-8
>5) my HttpRequest charset encoding is set to UTF-8
>
>I've tried everything but I can't get correct text from resources at
>*.vm page using MessageTool
>
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: velocity-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: velocity-user-help@jakarta.apache.org