You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by Michal Hlavac <hl...@medium13.sk> on 2005/02/20 23:23:01 UTC

output encoding?

hello,

I am writting tapestry application in Locale sk_SK (Slovakia).
I have pages with native slovak language.

and some Slovak special characters are encoded in output like this:
&#225; &#318;

also html special characters... is there any way to show this characters 
in original look???

thanx, miso

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


Re: output encoding?

Posted by Kent Tong <ke...@cpttm.org.mo>.
Kent Tong <kent <at> cpttm.org.mo> writes:

> 
> Kent Tong <kent <at> cpttm.org.mo> writes:
> 
> > Try overriding the following method in your page class to return
> > the desired output encoding:
> > 
> >   protected String getOutputEncoding() {
> >     return "utf-8"; //if utf-8 is desired
> >   }
> 
> Sorry, a much better way is to set the property in your .page file.

Sorry, I must be on drug. Tapestry will not look in your .page
file for its properties.



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


Re: output encoding?

Posted by Kent Tong <ke...@cpttm.org.mo>.
Kent Tong <kent <at> cpttm.org.mo> writes:

> Try overriding the following method in your page class to return
> the desired output encoding:
> 
>   protected String getOutputEncoding() {
>     return "utf-8"; //if utf-8 is desired
>   }

Sorry, a much better way is to set the property in your .page file.



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


Re: output encoding?

Posted by Kent Tong <ke...@cpttm.org.mo>.
David Leangen <dleangen <at> canada.com> writes:

> I will soon be looking into this, too, so I wanted to jump in here.
> 
> In my app, I will need to output different encodings, depending on the
> language preference. How would I do that? The above suggestion seems to only
> work with one encoding throughout the entire application...

Try overriding the following method in your page class to return
the desired output encoding:

  protected String getOutputEncoding() {
    return "utf-8"; //if utf-8 is desired
  }

I've not tried this one, but it should work.



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


Re: output encoding?

Posted by Marcus Brito <mb...@gmail.com>.
> My Japanese collegues say that there is not yet enough support in Japan for
> UTF-8 to make it useful. So, I need to be able to switch encodings for the
> Japanese version, then use UTF-8 for everyting else.

Fortunately this isn't true anymore, at least for web browsers.
Shift-JIS is still pretty much the standard for japanese encoded text
in the web, but *all* web browser support UTF-8 nicely. For email,
ISO-2022 is the usual text encoding, but again, all mail readers
handle UTF-8 fine enough. EUC-JP is history except for some old unix
programs.

The problem is about defaults. Most japanese software will assume text
is encoded in Shift-JIS unless stated otherwise. Thankfully, Tapestry
carefully outputs "Content-Type: text/html;charset=UTF-8" in the
headers, and that is enough to make all browsers out there switch to
UTF-8 encoding.

So, unless your japanese customers are using the output from your
webpages outside the browser (not likely), you can output UTF-8
safely. Using a single encoding in your application will save you lots
of headache later, specially if you store user input in a database.

-- Marcus Brito <mb...@gmail.com>

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


RE: output encoding?

Posted by David Leangen <dl...@canada.com>.
> Why can't you use unicode (i.e. utf-8)?

To be honest, I'm still not able to answer that question.

My Japanese collegues say that there is not yet enough support in Japan for
UTF-8 to make it useful. So, I need to be able to switch encodings for the
Japanese version, then use UTF-8 for everyting else.




> -----Original Message-----
> From: Marius Siegas [mailto:inkredibl@gmail.com]
> Sent: 21 February 2005 14:35
> To: Tapestry users
> Subject: Re: output encoding?
>
>
> Why can't you use unicode (i.e. utf-8)?
>
> On Mon, 21 Feb 2005 11:44:16 +0900, David Leangen
> <dl...@canada.com> wrote:
> >
> > > Try this in your .application file:
> > >
> > > <property name="org.apache.tapestry.output-encoding"
> value="iso-8859-2"/>
> >
> > I will soon be looking into this, too, so I wanted to jump in here.
> >
> > In my app, I will need to output different encodings, depending on the
> > language preference. How would I do that? The above suggestion
> seems to only
> > work with one encoding throughout the entire application...
>
> ---------------------------------------------------------------------
> 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: output encoding?

Posted by Marius Siegas <in...@gmail.com>.
Why can't you use unicode (i.e. utf-8)?

On Mon, 21 Feb 2005 11:44:16 +0900, David Leangen <dl...@canada.com> wrote:
> 
> > Try this in your .application file:
> >
> > <property name="org.apache.tapestry.output-encoding" value="iso-8859-2"/>
> 
> I will soon be looking into this, too, so I wanted to jump in here.
> 
> In my app, I will need to output different encodings, depending on the
> language preference. How would I do that? The above suggestion seems to only
> work with one encoding throughout the entire application...

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


Re: output encoding?

Posted by Michal Hlavac <hl...@medium13.sk>.
Mind Bridge wrote:
> Please do NOT change the output-encoding property over this.
> 
> The output encoding is UTF-8 by default and will easily handle all Slovak
> special characters as a result, as well as anything else.
> 
> Secondly, that will not have the desired effect -- Slovak symbols will still
> be quoted as &#225;, even with another output encoding.
> 
> The problem is not in the output encoding, but in the MarkupWriter. The
> default implementation automatically quotes all characters with a code above
> 127.

Yes. Sorry for my subject, but I didn't know, what kind of settings can
do this. Because all html entities (<, >, ...) are replaced (&lt; &gt;,
...). This is not problem of encoding...

> A patch that does not do this if the output encoding is UTF-8 was checked in
> the cvs head. A minute ago I would have said that it was in Tapestry
> 3.0.1/3.0.2 since they have the org.apache.tapestry.util.text package, but a
> quick check reveals that the patch is applied to them. I guess it was
> created after the split...
> 
> So what I would recommend instead as a solution is to override the
> getResponseWriter() method in your page. Copy the default markup writer from
> the Tapestry source (HTMLWriter and AbstractMarkupWriter), modify it not to
> quote the symbols above 127, and return an instance of it in
> getResponseWriter(). Sorry, it will work like that by default in the next
> version...

thanx for answer...

miso

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


Re: output encoding?

Posted by Andreas Andreou <an...@di.uoa.gr>.
One final note on this one...
Just be sure to also write your own
NestedHTMLWriter
and make it extend your own HTMLWriter

The only reason where all this process seems reasonable is to minimize 
the page size when one knows beforehand
which characted encoding he should support, i.e. in this way, i got a 
page to be one third of its original size
Andreas

Mind Bridge wrote:

>Hi,
>
>Please do NOT change the output-encoding property over this.
>
>The output encoding is UTF-8 by default and will easily handle all Slovak
>special characters as a result, as well as anything else.
>
>Secondly, that will not have the desired effect -- Slovak symbols will still
>be quoted as &#225;, even with another output encoding.
>
>The problem is not in the output encoding, but in the MarkupWriter. The
>default implementation automatically quotes all characters with a code above
>127.
>
>A patch that does not do this if the output encoding is UTF-8 was checked in
>the cvs head. A minute ago I would have said that it was in Tapestry
>3.0.1/3.0.2 since they have the org.apache.tapestry.util.text package, but a
>quick check reveals that the patch is applied to them. I guess it was
>created after the split...
>
>So what I would recommend instead as a solution is to override the
>getResponseWriter() method in your page. Copy the default markup writer from
>the Tapestry source (HTMLWriter and AbstractMarkupWriter), modify it not to
>quote the symbols above 127, and return an instance of it in
>getResponseWriter(). Sorry, it will work like that by default in the next
>version...
>
>Hope this helps...
>
>----- Original Message ----- 
>From: "Kent Tong" <ke...@cpttm.org.mo>
>To: <ta...@jakarta.apache.org>
>Sent: Monday, February 21, 2005 4:20 AM
>Subject: Re: output encoding?
>
>
>  
>
>>Michal Hlavac <hlavki <at> medium13.sk> writes:
>>
>>    
>>
>>>I am writting tapestry application in Locale sk_SK (Slovakia).
>>>I have pages with native slovak language.
>>>
>>>and some Slovak special characters are encoded in output like this:
>>>&#225; &#318;
>>>
>>>also html special characters... is there any way to show this characters
>>>in original look???
>>>      
>>>
>>Try this in your .application file:
>>
>><property name="org.apache.tapestry.output-encoding" value="iso-8859-2"/>
>>
>>Don't forget to restart your app.
>>
>>
>>
>>---------------------------------------------------------------------
>>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
>
>
>  
>


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


Re: output encoding?

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

Please do NOT change the output-encoding property over this.

The output encoding is UTF-8 by default and will easily handle all Slovak
special characters as a result, as well as anything else.

Secondly, that will not have the desired effect -- Slovak symbols will still
be quoted as &#225;, even with another output encoding.

The problem is not in the output encoding, but in the MarkupWriter. The
default implementation automatically quotes all characters with a code above
127.

A patch that does not do this if the output encoding is UTF-8 was checked in
the cvs head. A minute ago I would have said that it was in Tapestry
3.0.1/3.0.2 since they have the org.apache.tapestry.util.text package, but a
quick check reveals that the patch is applied to them. I guess it was
created after the split...

So what I would recommend instead as a solution is to override the
getResponseWriter() method in your page. Copy the default markup writer from
the Tapestry source (HTMLWriter and AbstractMarkupWriter), modify it not to
quote the symbols above 127, and return an instance of it in
getResponseWriter(). Sorry, it will work like that by default in the next
version...

Hope this helps...

----- Original Message ----- 
From: "Kent Tong" <ke...@cpttm.org.mo>
To: <ta...@jakarta.apache.org>
Sent: Monday, February 21, 2005 4:20 AM
Subject: Re: output encoding?


> Michal Hlavac <hlavki <at> medium13.sk> writes:
>
> > I am writting tapestry application in Locale sk_SK (Slovakia).
> > I have pages with native slovak language.
> >
> > and some Slovak special characters are encoded in output like this:
> > &#225; &#318;
> >
> > also html special characters... is there any way to show this characters
> > in original look???
>
> Try this in your .application file:
>
> <property name="org.apache.tapestry.output-encoding" value="iso-8859-2"/>
>
> Don't forget to restart your app.
>
>
>
> ---------------------------------------------------------------------
> 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: output encoding?

Posted by Kent Tong <ke...@cpttm.org.mo>.
David Leangen <dleangen <at> canada.com> writes:

> 
> BTW, where does one find a list of all the available properties?

C:/Tapestry-3.0/web/doc/TapestryUsersGuide/configuration.search-path.html



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


RE: output encoding?

Posted by David Leangen <dl...@canada.com>.
BTW, where does one find a list of all the available properties?

Thanks!



> -----Original Message-----
> From: David Leangen [mailto:dleangen@canada.com]
> Sent: 21 February 2005 11:44
> To: Tapestry users
> Subject: RE: output encoding?
> 
> 
> 
> > Try this in your .application file:
> >
> > <property name="org.apache.tapestry.output-encoding" 
> value="iso-8859-2"/>
> 
> 
> I will soon be looking into this, too, so I wanted to jump in here.
> 
> In my app, I will need to output different encodings, depending on the
> language preference. How would I do that? The above suggestion 
> seems to only
> work with one encoding throughout the entire application...
> 
> 
> 
> 
> ---------------------------------------------------------------------
> 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: output encoding?

Posted by David Leangen <dl...@canada.com>.
> Try this in your .application file:
>
> <property name="org.apache.tapestry.output-encoding" value="iso-8859-2"/>


I will soon be looking into this, too, so I wanted to jump in here.

In my app, I will need to output different encodings, depending on the
language preference. How would I do that? The above suggestion seems to only
work with one encoding throughout the entire application...




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


Re: output encoding?

Posted by Kent Tong <ke...@cpttm.org.mo>.
Michal Hlavac <hlavki <at> medium13.sk> writes:

> I am writting tapestry application in Locale sk_SK (Slovakia).
> I have pages with native slovak language.
> 
> and some Slovak special characters are encoded in output like this:
> &#225; &#318;
> 
> also html special characters... is there any way to show this characters 
> in original look???

Try this in your .application file:

<property name="org.apache.tapestry.output-encoding" value="iso-8859-2"/>

Don't forget to restart your app.



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