You have to bear in mind that the jvm uses the default charset when READING a file before tapestry ever gets its hands on it. If you have characters in a file that are incompatible with the default charset, they can get mangled on their way in to the jvm, and no setting of output parameters can possibly correct it. However, if tapestry is giving control over the output charset, it shouold presumably use that charset when reading the file as well, so setting the meta keys SHOULD work. However, there is absolutely nothing wrong with setting utf-8 as the default charset of your jvm. In fact, with a bit of research on google, you can probably figure out a way to make the jvm default to that charset without specifying a startup property (I think you have to set the LOCALE in linux/unix but I am unsure on windows/mac).
--sam On 5/30/06, Galam <[EMAIL PROTECTED]> wrote:
Hi mb, Thanks for the link to the configuration page. The explanation of the problem was in my original email. I hard coded a few chinese text in my UTF-8 encoded Home.html (see below), but the text didn't get render properly in web browser. The "-Dfile.encoding=UTF-8" option fixed it, but the <meta...> keys in *.application file didn't (although I thought they should). Home.html --------------- <html> <head> <meta http-equiv="content-type" content="text/html; charset=UTF-8"> </head> <body> <p>hello <span jwcid="subject">world</span>!</p> <p>中文测试</p> (hard coded chinese text here, but it shown up as garbage ) <BR> TEST2 </body> </html> Galam On 5/29/06, Mind Bridge <[EMAIL PROTECTED]> wrote: > > Hi Galam, > > How do you get the data that is not outputted in the correct encoding? > I haven't seen an explanation of that in your messages, but I am > guessing that it is obtained from a file or from something like a > database. As a result the data is not read properly and is "mangled" > _before_ it reaches the Tapestry layer. "-Dfile.encoding=UTF-8" fixes > that by ensuring that UTF-8 is used in input/output even if no encoding > is specified explicitly. > > A quick explanation of the Tapestry configuration keys that were listed > in case they are useful in other cases: > "org.apache.tapestry.template-encoding" defines the encoding that > Tapestry uses when it reads the templates (the .html files). > "org.apache.tapestry.messages-encoding" defines the encoding that > Tapestry uses when it reads the .property files. This setting is not > normally needed as it defaults to the value of "template-encoding", but > it can be defined if needed. > "org.apache.tapestry.output-encoding" defines the encoding that Tapestry > uses to communicate with the browser. It is UTF-8 by default to cover > all "specific" characters and there is normally no reason to change that. > > The full list of the configuration parameters is defined here: > http://jakarta.apache.org/tapestry/UsersGuide/configuration.html > and the following may be useful too: > > http://jakarta.apache.org/tapestry/UsersGuide/localization.html#localization.component-catalog.encoding > > -mb > > > Specifying the encoding in the *.application file doens't work (I've > > tried > > all three encoding options below, none of them work). > > > > <?xml version="1.0" encoding="UTF-8"?> > > <!DOCTYPE application PUBLIC "-//Apache Software Foundation//Tapestry > > Specification 4.0//EN" > > "http://jakarta.apache.org/tapestry/dtd/Tapestry_4_0.dtd"> > > <application> > > <meta key="org.apache.tapestry.output-encoding" value="UTF-8"/> > > <meta key="org.apache.tapestry.messages-encoding" value="UTF-8"/> > > <meta key="org.apache.tapestry.template-encoding" value="UTF-8"/> > > </application> > > > > > > The only thing that works is by passing the "-Dfile.encoding=UTF-8" > > option > > to the java.exe in the catalina startup script. > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > >