UTF-8 encoding

View: New views
5 Messages — Rating Filter:   Alert me  

UTF-8 encoding

by Ludwig Magnusson :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi!

How can I make the browser display my page with UTF-8 encoding when using
turbine and velocity?

In my layout template I have the line:

$page.setHttpEquiv("Content-Type", "text/html; charset=UTF-8")

Which generates:

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

 

The browser is still set on ISO-8895-1 however.

I found some solutions for tomcat but they were all directed to jsp based
sites. Is the problem in turbine/velocity or tomcat?

/Ludwig


Re: UTF-8 encoding

by ritso - Thomas Pfäfflin :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi Ludwig,

i have the following settings in my properties file to my my screens and
forms work with UTF-8:

services.VelocityService.input.encoding=UTF-8
services.VelocityService.output.encoding=UTF-8
locale.default.charset=UTF-8
input.encoding=UTF-8

i use turbine-2.3.2 and velocity-1.3.1. UTF-8 did not work with earlier
version.

/Thomas

Ludwig Magnusson schrieb:

> Hi!
>
> How can I make the browser display my page with UTF-8 encoding when using
> turbine and velocity?
>
> In my layout template I have the line:
>
> $page.setHttpEquiv("Content-Type", "text/html; charset=UTF-8")
>
> Which generates:
>
> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
>
>  
>
> The browser is still set on ISO-8895-1 however.
>
> I found some solutions for tomcat but they were all directed to jsp based
> sites. Is the problem in turbine/velocity or tomcat?
>
> /Ludwig
>
>
>  


--

ritso.de - Realisierung von IT- und Softwarelösungen
Thomas Pfäfflin
Benkendorffstr. 63
91522 Ansbach
Tel: 0981-9723330
Fax: 0981-9723331


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@...
For additional commands, e-mail: user-help@...


RE: UTF-8 encoding

by Ludwig Magnusson :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

I love answers like these!!!
You just put them in to you project and they work at once.
Thank you very much Thomas!
/Ludwig

-----Original Message-----
From: "Thomas Pfäfflin (ritso)" [mailto:info@...]
Sent: den 30 mars 2009 09:01
To: Turbine Users List
Subject: Re: UTF-8 encoding

Hi Ludwig,

i have the following settings in my properties file to my my screens and
forms work with UTF-8:

services.VelocityService.input.encoding=UTF-8
services.VelocityService.output.encoding=UTF-8
locale.default.charset=UTF-8
input.encoding=UTF-8

i use turbine-2.3.2 and velocity-1.3.1. UTF-8 did not work with earlier
version.

/Thomas

Ludwig Magnusson schrieb:

> Hi!
>
> How can I make the browser display my page with UTF-8 encoding when using
> turbine and velocity?
>
> In my layout template I have the line:
>
> $page.setHttpEquiv("Content-Type", "text/html; charset=UTF-8")
>
> Which generates:
>
> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
>
>  
>
> The browser is still set on ISO-8895-1 however.
>
> I found some solutions for tomcat but they were all directed to jsp based
> sites. Is the problem in turbine/velocity or tomcat?
>
> /Ludwig
>
>
>  


--

ritso.de - Realisierung von IT- und Softwarelösungen
Thomas Pfäfflin
Benkendorffstr. 63
91522 Ansbach
Tel: 0981-9723330
Fax: 0981-9723331


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@...
For additional commands, e-mail: user-help@...



---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@...
For additional commands, e-mail: user-help@...


RE: UTF-8 encoding

by Tony Oslund-3 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


I work with turbine 2.3.1 and velocity 1.4 and have had success with setting the following within the isAuthorized method (with pretty much any character encoding)

HttpServletResponse response = data.getResponse();

response.setCharacterEncoding(charSet);
// where charSet is ISO-8859-1, GB2312, UTF-8, etc

response.setContentType(contentType);  
// where contentType is <meta http-equiv="content-type" content="application/xhtml+xml; charset=ISO-8859-1" />, etc

The advantage of doing the above is that you can change the encoding on the fly for different languages.

You can certainly embed the above within the meta tags, but some browsers (IE7, etc) will ignore them.  The above works around that.

Tony Oslund

-----Original Message-----
From: Ludwig Magnusson [mailto:ludwig@...]
Sent: Monday, March 30, 2009 2:50 AM
To: 'Turbine Users List'
Subject: RE: UTF-8 encoding

I love answers like these!!!
You just put them in to you project and they work at once.
Thank you very much Thomas!
/Ludwig

-----Original Message-----
From: "Thomas Pfäfflin (ritso)" [mailto:info@...]
Sent: den 30 mars 2009 09:01
To: Turbine Users List
Subject: Re: UTF-8 encoding

Hi Ludwig,

i have the following settings in my properties file to my my screens and
forms work with UTF-8:

services.VelocityService.input.encoding=UTF-8
services.VelocityService.output.encoding=UTF-8
locale.default.charset=UTF-8
input.encoding=UTF-8

i use turbine-2.3.2 and velocity-1.3.1. UTF-8 did not work with earlier
version.

/Thomas

Ludwig Magnusson schrieb:

> Hi!
>
> How can I make the browser display my page with UTF-8 encoding when using
> turbine and velocity?
>
> In my layout template I have the line:
>
> $page.setHttpEquiv("Content-Type", "text/html; charset=UTF-8")
>
> Which generates:
>
> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
>
>  
>
> The browser is still set on ISO-8895-1 however.
>
> I found some solutions for tomcat but they were all directed to jsp based
> sites. Is the problem in turbine/velocity or tomcat?
>
> /Ludwig
>
>
>  


--

ritso.de - Realisierung von IT- und Softwarelösungen
Thomas Pfäfflin
Benkendorffstr. 63
91522 Ansbach
Tel: 0981-9723330
Fax: 0981-9723331


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@...
For additional commands, e-mail: user-help@...



---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@...
For additional commands, e-mail: user-help@...


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@...
For additional commands, e-mail: user-help@...


Re: UTF-8 encoding

by Thomas Vandahl-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Ludwig Magnusson wrote:
> I love answers like these!!!
> You just put them in to you project and they work at once.
> Thank you very much Thomas!
> /Ludwig

Be aware, though that the encoding of URL-parameters (for GET-requests)
is still interpreted by Tomcat as ISO-8859-1. You may want to set
useBodyEncodingForURI="true" in the connector in use. See
http://tomcat.apache.org/tomcat-5.5-doc/config/ajp.html on what this does.

Bye, Thomas.


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@...
For additional commands, e-mail: user-help@...