You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by Andreas Pardeike <an...@pardeike.net> on 2004/10/13 09:24:04 UTC

Encoding problem - strategy needed

Hi,

I played around with various alternatives about choosing utf-8 for
text encoding but I am stuck with no working solution.

I could either live with a clean utf-8 *or* latin1 solution but neither
seems to work. Here's what I tried so far:

1) On default, tapestry does weird things if I save my html files as
utf-8 so I tried switching eclipse to latin1 (iso-5589-1) and resave
the file. The result is weird. Now it still set the encoding in the
final output to utf-8 regardless what I configure. My pages look like
this:

<html>
	<span jwcid="@Shell"
		renderContentType="true"
		stylesheet="ognl:assets.stylesheet" />
	<body>
....
	</body>
</html>

I tried to remove renderContentType="true" or set it to false but it
does not change anything.


So I tried the other way around (that's what I use right now):


2) use utf-8 all the way. I found the example via google that overwrites
getResponseWriter and it seems to work. I save all my html files as 
utf-8
and change the html header to

<html>
	<span jwcid="@Shell"
		doctype='HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" 
"http://www.w3.org/TR/html4/loose.dtd'
		renderContentType="true"
		stylesheet="ognl:assets.stylesheet"
		title="SOMETITLEHERE"/>

Now a new problem arises. 'SOMETITLEHERE' isn't correctly encoded! 
Umlauts
in it get weird. Interestingly, if I change it to message:title and add 
a
property file then it works cool.

What's the overall best strategy? I am a bit concerned about browser
compatibility if I keep my utf-8 strategy (although its tempting to
use it).

Anyone can help?

Greetings from Sweden,
Andreas Pardeike


---------------------------------------------------------------------
To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tapestry-user-help@jakarta.apache.org


Re: Encoding problem

Posted by Cyril Godefroy <cy...@ecomposite.fr>.
Could one of the committers put this in the FAQ section of  
jakarta.apache.org/tapestry? It's worth it. If it's not a very  
frequently asked question, it is prone to become one.

Thanks

> Hi,
>
> The encoding issue has two elements:
>
> 1) The character set(s) used to encode the templates.
>
> 2) The character set used to encode the generated HTML
>
>
> The two are different, and are not related. If I understand your  
> message
> correctly, you have a problem with (1) -- your templates are most  
> likely not
> read correctly by the application.
>
> Please have a look at the following part of the documentation:
> http://jakarta.apache.org/tapestry/doc/TapestryUsersGuide/ 
> configuration.character-sets.html
>
> In short, you could add something like this:
>
> <property name="org.apache.tapestry.template-encoding" value="UTF-8"/>
>
> to the .application file or to the relevant .page files and the  
> templates
> would use the UTF-8 encoding.
>
>
> Please note that (2) defaults to UTF-8 and covers almost all encodings  
> that
> could be used for the templates as a result. Typically there is no  
> need to
> change that (although it is possible).
>
>
> I hope this helps,
> -mb
>
> ----- Original Message -----
> From: "Andreas Pardeike" <an...@pardeike.net>
> To: "Tapestry users" <ta...@jakarta.apache.org>
> Sent: Wednesday, October 13, 2004 10:24 AM
> Subject: Encoding problem - strategy needed
>
>
>> Hi,
>>
>> I played around with various alternatives about choosing utf-8 for
>> text encoding but I am stuck with no working solution.
>>
>> I could either live with a clean utf-8 *or* latin1 solution but  
>> neither
>> seems to work. Here's what I tried so far:
>>
>> 1) On default, tapestry does weird things if I save my html files as
>> utf-8 so I tried switching eclipse to latin1 (iso-5589-1) and resave
>> the file. The result is weird. Now it still set the encoding in the
>> final output to utf-8 regardless what I configure. My pages look like
>> this:
>>
>> <html>
>> <span jwcid="@Shell"
>> renderContentType="true"
>> stylesheet="ognl:assets.stylesheet" />
>> <body>
>> ....
>> </body>
>> </html>
>>
>> I tried to remove renderContentType="true" or set it to false but it
>> does not change anything.
>>
>>
>> So I tried the other way around (that's what I use right now):
>>
>>
>> 2) use utf-8 all the way. I found the example via google that  
>> overwrites
>> getResponseWriter and it seems to work. I save all my html files as
>> utf-8
>> and change the html header to
>>
>> <html>
>> <span jwcid="@Shell"
>> doctype='HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
>> "http://www.w3.org/TR/html4/loose.dtd'
>> renderContentType="true"
>> stylesheet="ognl:assets.stylesheet"
>> title="SOMETITLEHERE"/>
>>
>> Now a new problem arises. 'SOMETITLEHERE' isn't correctly encoded!
>> Umlauts
>> in it get weird. Interestingly, if I change it to message:title and  
>> add
>> a
>> property file then it works cool.
>>
>> What's the overall best strategy? I am a bit concerned about browser
>> compatibility if I keep my utf-8 strategy (although its tempting to
>> use it).
>>
>> Anyone can help?
>>
>> Greetings from Sweden,
>> Andreas Pardeike
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
>> For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
>>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
>

Re: Encoding problem - strategy needed SOLVED

Posted by Andreas Pardeike <an...@pardeike.net>.
On 13 okt 2004, at 09.47, Mind Bridge wrote:

> 1) The character set(s) used to encode the templates.
>
> 2) The character set used to encode the generated HTML
>
>
> The two are different, and are not related. If I understand your  
> message
> correctly, you have a problem with (1) -- your templates are most  
> likely not
> read correctly by the application.

You're right.

> Please have a look at the following part of the documentation:
> http://jakarta.apache.org/tapestry/doc/TapestryUsersGuide/ 
> configuration.character-sets.html

Good pointer.

> In short, you could add something like this:
>
> <property name="org.apache.tapestry.template-encoding" value="UTF-8"/>
>
> to the .application file or to the relevant .page files and the  
> templates
> would use the UTF-8 encoding.

Works perfectly and I don't need to overwrite getResponseWriter. Great!

> Please note that (2) defaults to UTF-8 and covers almost all encodings  
> that
> could be used for the templates as a result. Typically there is no  
> need to
> change that (although it is possible).

I thought so.

Thanks a lot,
Andreas Pardeike


---------------------------------------------------------------------
To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tapestry-user-help@jakarta.apache.org


Re: Encoding problem - strategy needed

Posted by Mind Bridge <mi...@yahoo.com>.
Hi,

The encoding issue has two elements:

1) The character set(s) used to encode the templates.

2) The character set used to encode the generated HTML


The two are different, and are not related. If I understand your message
correctly, you have a problem with (1) -- your templates are most likely not
read correctly by the application.

Please have a look at the following part of the documentation:
http://jakarta.apache.org/tapestry/doc/TapestryUsersGuide/configuration.character-sets.html

In short, you could add something like this:

<property name="org.apache.tapestry.template-encoding" value="UTF-8"/>

to the .application file or to the relevant .page files and the templates
would use the UTF-8 encoding.


Please note that (2) defaults to UTF-8 and covers almost all encodings that
could be used for the templates as a result. Typically there is no need to
change that (although it is possible).


I hope this helps,
-mb

----- Original Message ----- 
From: "Andreas Pardeike" <an...@pardeike.net>
To: "Tapestry users" <ta...@jakarta.apache.org>
Sent: Wednesday, October 13, 2004 10:24 AM
Subject: Encoding problem - strategy needed


> Hi,
>
> I played around with various alternatives about choosing utf-8 for
> text encoding but I am stuck with no working solution.
>
> I could either live with a clean utf-8 *or* latin1 solution but neither
> seems to work. Here's what I tried so far:
>
> 1) On default, tapestry does weird things if I save my html files as
> utf-8 so I tried switching eclipse to latin1 (iso-5589-1) and resave
> the file. The result is weird. Now it still set the encoding in the
> final output to utf-8 regardless what I configure. My pages look like
> this:
>
> <html>
> <span jwcid="@Shell"
> renderContentType="true"
> stylesheet="ognl:assets.stylesheet" />
> <body>
> ....
> </body>
> </html>
>
> I tried to remove renderContentType="true" or set it to false but it
> does not change anything.
>
>
> So I tried the other way around (that's what I use right now):
>
>
> 2) use utf-8 all the way. I found the example via google that overwrites
> getResponseWriter and it seems to work. I save all my html files as
> utf-8
> and change the html header to
>
> <html>
> <span jwcid="@Shell"
> doctype='HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
> "http://www.w3.org/TR/html4/loose.dtd'
> renderContentType="true"
> stylesheet="ognl:assets.stylesheet"
> title="SOMETITLEHERE"/>
>
> Now a new problem arises. 'SOMETITLEHERE' isn't correctly encoded!
> Umlauts
> in it get weird. Interestingly, if I change it to message:title and add
> a
> property file then it works cool.
>
> What's the overall best strategy? I am a bit concerned about browser
> compatibility if I keep my utf-8 strategy (although its tempting to
> use it).
>
> Anyone can help?
>
> Greetings from Sweden,
> Andreas Pardeike
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
>


---------------------------------------------------------------------
To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tapestry-user-help@jakarta.apache.org