RE: Can I change Tomcat's default character encoding?
In the catalina.bat (catalina.sh) I added the java args... set JAVA_OPTS=-Djavax.servlet.request.encoding=UTF-8 -Dfile.encoding=UTF-8 then all my encodings seem to come across as UTF-8 by default.. so far its been working. -Rick -Original Message- From: rlipi [mailto:[EMAIL PROTECTED] Posted At: Thursday, May 27, 2004 2:20 AM Posted To: Tomcat Dev Conversation: Can I change Tomcat's default character encoding? Subject: RE: Can I change Tomcat's default character encoding? Thank you for the answer. I know about this possibility using filters (and I have done something). But the original question (and my question) is about simpler way: Is it possible to globally set (somewhere in JVM or Tomcat configuration) default character encoding for all created Writers? Lipi > -Original Message- > From: Yansheng Lin [mailto:[EMAIL PROTECTED] > Sent: Wednesday, May 26, 2004 7:45 PM > To: 'Tomcat Users List' > Subject: RE: Can I change Tomcat's default character encoding? > > Hi, quick response, you can use your own customized OutputStreamWriter. > You > need to extend the abstract class ServletOutputStream. And you integrate > your customized writer with tomcat by implementing a filter. > > For more info on how to use filters, you can do a search on google. > > This will only work for Tomcat 4 and up, or any other container that > implement Servlet 2.3 and up. > > -Yan > - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Can I change Tomcat's default character encoding?
>From Javadoc for OutputStreamWriter: An OutputStreamWriter is a bridge from character streams to byte streams: Characters written to it are encoded into bytes using a specified charset. The charset that it uses may be specified by name or may be given explicitly, or the platform's default charset may be accepted. So the answer is verdor-specific. Of course, you can tell javac and java runtime to use the desired encoding, but that's not fool-proof. To do a conversion from one encoding to another, you can use the new String(oldBytes, charset) constructor. You can implement that in your customized Writer. Hope it helps:). -Yan -Original Message- From: rlipi [mailto:[EMAIL PROTECTED] Sent: May 27, 2004 03:20 To: 'Tomcat Users List' Subject: RE: Can I change Tomcat's default character encoding? Thank you for the answer. I know about this possibility using filters (and I have done something). But the original question (and my question) is about simpler way: Is it possible to globally set (somewhere in JVM or Tomcat configuration) default character encoding for all created Writers? Lipi > -Original Message- > From: Yansheng Lin [mailto:[EMAIL PROTECTED] > Sent: Wednesday, May 26, 2004 7:45 PM > To: 'Tomcat Users List' > Subject: RE: Can I change Tomcat's default character encoding? > > Hi, quick response, you can use your own customized OutputStreamWriter. > You > need to extend the abstract class ServletOutputStream. And you integrate > your customized writer with tomcat by implementing a filter. > > For more info on how to use filters, you can do a search on google. > > This will only work for Tomcat 4 and up, or any other container that > implement Servlet 2.3 and up. > > -Yan > - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Can I change Tomcat's default character encoding?
Thank you for the answer. I know about this possibility using filters (and I have done something). But the original question (and my question) is about simpler way: Is it possible to globally set (somewhere in JVM or Tomcat configuration) default character encoding for all created Writers? Lipi > -Original Message- > From: Yansheng Lin [mailto:[EMAIL PROTECTED] > Sent: Wednesday, May 26, 2004 7:45 PM > To: 'Tomcat Users List' > Subject: RE: Can I change Tomcat's default character encoding? > > Hi, quick response, you can use your own customized OutputStreamWriter. > You > need to extend the abstract class ServletOutputStream. And you integrate > your customized writer with tomcat by implementing a filter. > > For more info on how to use filters, you can do a search on google. > > This will only work for Tomcat 4 and up, or any other container that > implement Servlet 2.3 and up. > > -Yan > - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Can I change Tomcat's default character encoding?
Hi, quick response, you can use your own customized OutputStreamWriter. You need to extend the abstract class ServletOutputStream. And you integrate your customized writer with tomcat by implementing a filter. For more info on how to use filters, you can do a search on google. This will only work for Tomcat 4 and up, or any other container that implement Servlet 2.3 and up. -Yan -Original Message- From: rlipi [mailto:[EMAIL PROTECTED] Sent: May 26, 2004 00:49 To: 'Tomcat Users List' Subject: RE: Can I change Tomcat's default character encoding? > -Original Message- > From: Yansheng Lin [mailto:[EMAIL PROTECTED] > Sent: Tuesday, May 25, 2004 11:57 PM > To: 'Tomcat Users List' > Subject: RE: Can I change Tomcat's default character encoding? > > Also you may have to change > your > OS default locale since JVM and Java Runtime uses system default language > environment. > Is there any way to set default encoding for created writers? For instance - class OutputStreamWriter has constructors with or without charset parameter. If no charset is specified, the default one will be used. And it depends on the system. It makes problems when same (web) application should run on different platforms (Windows, Linux, etc.). I have not system under my control but I have Tomcat web servers under control. So, question is - can I configure JAVA VM (or Tomcat itself) to create OutputStreamWriter(s) with my default character encoding? Thank you, Lipi. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Can I change Tomcat's default character encoding?
> -Original Message- > From: Yansheng Lin [mailto:[EMAIL PROTECTED] > Sent: Tuesday, May 25, 2004 11:57 PM > To: 'Tomcat Users List' > Subject: RE: Can I change Tomcat's default character encoding? > > Also you may have to change > your > OS default locale since JVM and Java Runtime uses system default language > environment. > Is there any way to set default encoding for created writers? For instance - class OutputStreamWriter has constructors with or without charset parameter. If no charset is specified, the default one will be used. And it depends on the system. It makes problems when same (web) application should run on different platforms (Windows, Linux, etc.). I have not system under my control but I have Tomcat web servers under control. So, question is - can I configure JAVA VM (or Tomcat itself) to create OutputStreamWriter(s) with my default character encoding? Thank you, Lipi. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Can I change Tomcat's default character encoding?
Tomcat uses parameter "javaEncoding" in $TOMCAT_HOME/conf/web.xml to define Java file encoding. The default is utf-8. You can change it to your preferred encoding so that the compiled java source from jsp file will use your encoding. You may have to define a encoding filter. Also you may have to change your OS default locale since JVM and Java Runtime uses system default language environment. It all depends on your system. Hope it helps:). -Yan -Original Message- From: Allistair Crossley [mailto:[EMAIL PROTECTED] Sent: May 24, 2004 03:59 To: [EMAIL PROTECTED] Subject: Can I change Tomcat's default character encoding? We are having a host of problems with character encoding at the moment. Somehow between the UI and the Struts Action our euro symbols are being turned into question marks. I have fiddled with the JVM file.encoding, using JSP page directives for content type and much else besides. I thought Java strings were UTF-8 by default. Anyway, I stripped off the JSP page directive for encoding and it appears the tomcat default becomes Latin 1 ISO-8859-1. The euro character does not appear in this charset and I need Cp1252 to be default. Can I change Tomcat's default charset? Thanks ADC --- QAS Ltd. Developers of QuickAddress Software http://www.qas.com";>www.qas.com Registered in England: No 2582055 Registered in Australia: No 082 851 474 --- - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Can I change Tomcat's default character encoding?
Allistair Crossley wrote: We are having a host of problems with character encoding at the moment. Somehow between the UI and the Struts Action our euro symbols are being turned into question marks. I have fiddled with the JVM file.encoding, using JSP page directives for content type and much else besides. I thought Java strings were UTF-8 by default. Anyway, I stripped off the JSP page directive for encoding and it appears the tomcat default becomes Latin 1 ISO-8859-1. The euro character does not appear in this charset and I need Cp1252 to be default. Can I change Tomcat's default charset? Thanks ADC Allistair, I think that you might find that sicking with UTF-8 will give you the most long-term joy. Here is a link to some info about i18n that may be of use to you. http://www.anassina.com/struts/i18n/i18n.html Mike - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]