Re: Setting UTF-8 Encoding
I am sorry. It has something to do with struts. Coz if I place my JSP in examples or tomcat-docs it works fine. Somehow Struts is messing things up. Or i havent configured things properly. Affan - Original Message - From: "Daniel Brown" <[EMAIL PROTECTED]> To: "Tomcat Users List" <[EMAIL PROTECTED]> Sent: Friday, January 31, 2003 5:50 PM Subject: RE: Setting UTF-8 Encoding > Affan, > > The encoding is set just fine. If I copy and paste your JSP, and run it > here, I get the following as the content type in the HTTP headers: > > Content-Type: text/html; charset=UTF-8 > > You're seeing empty squares where you'd expect characters for a couple of > reasons: > > The Unicode escape for trademark is \u2122, according to the HTML 4.01 spec. > The raw copyright characters in your document are in ISO-8859-1, not UTF-8. > > If you replace \u0099 by \u2122, it works just fine. > > Alternatively, why not use ™, ©, and ® instead? > > HTH, > > Dan. > > > -Original Message- > > From: Affan Qureshi [mailto:[EMAIL PROTECTED]] > > Sent: 31 January 2003 11:38 > > To: Tomcat Users List > > Subject: Setting UTF-8 Encoding > > > > > > I am having trouble setting the encoding to UTF-8 and hence my > > web pages are > > unable to render characters like the Trademark or Copyright symbols. In > > Tomcat's source at various places teh character encoding is > > hard-coded to be > > ISO-8859-1. I have tried to use the filter in the examples to set the > > encoding type but that did not help and I kept seeing questionamarks for > > those characters. I have also tried to modify the source and > > build again but > > that doesn't work either (I know I must be doing something wrong here.) > > > > Somehow tomcat doesn't allow me to change the character encoding to UTF-8. > > The same JSPs are looking fine on Weblogic and Resin without any > > configuration/modification to the server settings. > > > > Any ideas how can I fix this ugly problem in my app. The app is unusable > > without this. > > > > Thanks a lot. > > > > Affan > > > > > > - > > 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] > - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Setting UTF-8 Encoding
You have in your mind that there are several levels where there can happen mischief with international characters. - Generating java for the jsp You can verify this by a look at the generated source in the work directory. Do they look like you expect? - Compiling the generated java I don't know how you can control which encoding is used to compile the source. (As I'm not using tomcat much, I had not to deal with this yet) - Handling at runtime - Setting no/wrong headers - The browser. As your code works in other engines these levels are the ones which are least likely to be the cause of the problem. My guess is, that it is #2 that is causing the pain. > -Original Message- > From: Affan Qureshi [mailto:[EMAIL PROTECTED]] > Sent: Friday, January 31, 2003 1:47 PM > To: Tomcat Users List > Subject: Re: Setting UTF-8 Encoding > > > Locale object is set to to "en_US" by default. And I am using > Tomcat 4.1.18 > on Win2K. i have also tried the same on SunSOLARIS and Linux. > > If I use servlets instead of JSP it works fine and output the > characters as > required. But i guess its the JSPWriter that does something > which shows teh > question marks in place of those characters. > > However, the same JSP code works in for Resin and Weblogic. > > Baffled > > Affan > > - Original Message - > From: "Masood Ahmed" <[EMAIL PROTECTED]> > To: "Tomcat Users List" <[EMAIL PROTECTED]> > Sent: Friday, January 31, 2003 5:13 PM > Subject: Re: Setting UTF-8 Encoding > > > > Have you tried setting the locale directly on the > > request object? See if that helps. > > > > What version of tomcat are you using? > > > > thanks, > > -Masood > > > > --- Affan Qureshi <[EMAIL PROTECTED]> wrote: > > > I forgot to paste my code which is there at the > > > bottom now. > > > > > > > I am having trouble setting the encoding to UTF-8 > > > and hence my web pages > > > are > > > > unable to render characters like the Trademark or > > > Copyright symbols. In > > > > Tomcat's source at various places teh character > > > encoding is hard-coded to > > > be > > > > ISO-8859-1. I have tried to use the filter in the > > > examples to set the > > > > encoding type but that did not help and I kept > > > seeing questionamarks for > > > > those characters. I have also tried to modify the > > > source and build again > > > but > > > > that doesn't work either (I know I must be doing > > > something wrong here.) > > > > > > > > Somehow tomcat doesn't allow me to change the > > > character encoding to UTF-8. > > > > The same JSPs are looking fine on Weblogic and > > > Resin without any > > > > configuration/modification to the server settings. > > > > > > > > Any ideas how can I fix this ugly problem in my > > > app. The app is unusable > > > > without this. > > > > > > > > Thanks a lot. > > > > > > > > Affan > > > > > > Here is my code for the Test JSP: > > > <%@page contentType="text/html; charset=UTF-8"%> > > > > > > Test JSP > > > > > > <% out.println('\u00A9'); %> > > > <% System.out.println("This © is test");%> > > > > > > <% out.println("This ° is test"); %> > > > > > > <% out.println("This © is test"); %> > > > > > > <% out.println("This \u00A9 is test"); %> <%= "©"%> > > > > > > <% out.println("This \u00B0 is test"); %> > > > > > > <% out.println("This \u00AE is test"); %> > > > > > > <% out.println("This \u0099 is test"); %> > > > > > > <% out.println("This \u00F6 is test"); %> > > > <% out.flush(); %> > > > > > > > > > > > > > > > > > > - > > > To unsubscribe, e-mail: > > > [EMAIL PROTECTED] > > > For additional commands, e-mail: > > > [EMAIL PROTECTED] > > > > > > > > > __ > > Do you Yahoo!? > > Yahoo! Mail Plus - Powerful. Affordable. Sign up now. > > http://mailplus.yahoo.com > > > > > - > > 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] > > > - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Setting UTF-8 Encoding
Thanks for your help. > Affan, > > The encoding is set just fine. If I copy and paste your JSP, and run it > here, I get the following as the content type in the HTTP headers: > > Content-Type: text/html; charset=UTF-8 > > You're seeing empty squares where you'd expect characters for a couple of > reasons: > > The Unicode escape for trademark is \u2122, according to the HTML 4.01 spec. > The raw copyright characters in your document are in ISO-8859-1, not UTF-8. > If you replace \u0099 by \u2122, it works just fine. Unfortunately I get the same '?' in place of those characters even by replacing it. > Alternatively, why not use ™, ©, and ® instead? The problem is that the data entry guys will copy/paste these symbols from the webpages and they will go just as the come. When viewing from database the JSP has to recognize the characters and display them accordingly. Even if i use a filter for replacing these characters it won't help because the JSPWriter would have placed the ? already in the stream being sent to the browser. The same thing works for Servlets but not for JSPs. I read that the writer in Servlets uses the content-type set in request to determine the encoding while JSPWriter uses the system settings of the Locale or something. Nasty problem isn't it? > HTH, > > Dan. Affan > > > -Original Message- > > From: Affan Qureshi [mailto:[EMAIL PROTECTED]] > > Sent: 31 January 2003 11:38 > > To: Tomcat Users List > > Subject: Setting UTF-8 Encoding > > > > > > I am having trouble setting the encoding to UTF-8 and hence my > > web pages are > > unable to render characters like the Trademark or Copyright symbols. In > > Tomcat's source at various places teh character encoding is > > hard-coded to be > > ISO-8859-1. I have tried to use the filter in the examples to set the > > encoding type but that did not help and I kept seeing questionamarks for > > those characters. I have also tried to modify the source and > > build again but > > that doesn't work either (I know I must be doing something wrong here.) > > > > Somehow tomcat doesn't allow me to change the character encoding to UTF-8. > > The same JSPs are looking fine on Weblogic and Resin without any > > configuration/modification to the server settings. > > > > Any ideas how can I fix this ugly problem in my app. The app is unusable > > without this. > > > > Thanks a lot. > > > > Affan > - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Setting UTF-8 Encoding
Affan, The encoding is set just fine. If I copy and paste your JSP, and run it here, I get the following as the content type in the HTTP headers: Content-Type: text/html; charset=UTF-8 You're seeing empty squares where you'd expect characters for a couple of reasons: The Unicode escape for trademark is \u2122, according to the HTML 4.01 spec. The raw copyright characters in your document are in ISO-8859-1, not UTF-8. If you replace \u0099 by \u2122, it works just fine. Alternatively, why not use ™, ©, and ® instead? HTH, Dan. > -Original Message- > From: Affan Qureshi [mailto:[EMAIL PROTECTED]] > Sent: 31 January 2003 11:38 > To: Tomcat Users List > Subject: Setting UTF-8 Encoding > > > I am having trouble setting the encoding to UTF-8 and hence my > web pages are > unable to render characters like the Trademark or Copyright symbols. In > Tomcat's source at various places teh character encoding is > hard-coded to be > ISO-8859-1. I have tried to use the filter in the examples to set the > encoding type but that did not help and I kept seeing questionamarks for > those characters. I have also tried to modify the source and > build again but > that doesn't work either (I know I must be doing something wrong here.) > > Somehow tomcat doesn't allow me to change the character encoding to UTF-8. > The same JSPs are looking fine on Weblogic and Resin without any > configuration/modification to the server settings. > > Any ideas how can I fix this ugly problem in my app. The app is unusable > without this. > > Thanks a lot. > > Affan > > > - > 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: Setting UTF-8 Encoding
Locale object is set to to "en_US" by default. And I am using Tomcat 4.1.18 on Win2K. i have also tried the same on SunSOLARIS and Linux. If I use servlets instead of JSP it works fine and output the characters as required. But i guess its the JSPWriter that does something which shows teh question marks in place of those characters. However, the same JSP code works in for Resin and Weblogic. Baffled Affan - Original Message - From: "Masood Ahmed" <[EMAIL PROTECTED]> To: "Tomcat Users List" <[EMAIL PROTECTED]> Sent: Friday, January 31, 2003 5:13 PM Subject: Re: Setting UTF-8 Encoding > Have you tried setting the locale directly on the > request object? See if that helps. > > What version of tomcat are you using? > > thanks, > -Masood > > --- Affan Qureshi <[EMAIL PROTECTED]> wrote: > > I forgot to paste my code which is there at the > > bottom now. > > > > > I am having trouble setting the encoding to UTF-8 > > and hence my web pages > > are > > > unable to render characters like the Trademark or > > Copyright symbols. In > > > Tomcat's source at various places teh character > > encoding is hard-coded to > > be > > > ISO-8859-1. I have tried to use the filter in the > > examples to set the > > > encoding type but that did not help and I kept > > seeing questionamarks for > > > those characters. I have also tried to modify the > > source and build again > > but > > > that doesn't work either (I know I must be doing > > something wrong here.) > > > > > > Somehow tomcat doesn't allow me to change the > > character encoding to UTF-8. > > > The same JSPs are looking fine on Weblogic and > > Resin without any > > > configuration/modification to the server settings. > > > > > > Any ideas how can I fix this ugly problem in my > > app. The app is unusable > > > without this. > > > > > > Thanks a lot. > > > > > > Affan > > > > Here is my code for the Test JSP: > > <%@page contentType="text/html; charset=UTF-8"%> > > > > Test JSP > > > > <% out.println('\u00A9'); %> > > <% System.out.println("This © is test");%> > > > > <% out.println("This ° is test"); %> > > > > <% out.println("This © is test"); %> > > > > <% out.println("This \u00A9 is test"); %> <%= "©"%> > > > > <% out.println("This \u00B0 is test"); %> > > > > <% out.println("This \u00AE is test"); %> > > > > <% out.println("This \u0099 is test"); %> > > > > <% out.println("This \u00F6 is test"); %> > > <% out.flush(); %> > > > > > > > > > > > - > > To unsubscribe, e-mail: > > [EMAIL PROTECTED] > > For additional commands, e-mail: > > [EMAIL PROTECTED] > > > > > __ > Do you Yahoo!? > Yahoo! Mail Plus - Powerful. Affordable. Sign up now. > http://mailplus.yahoo.com > > - > 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: Setting UTF-8 Encoding
Have you tried setting the locale directly on the request object? See if that helps. What version of tomcat are you using? thanks, -Masood --- Affan Qureshi <[EMAIL PROTECTED]> wrote: > I forgot to paste my code which is there at the > bottom now. > > > I am having trouble setting the encoding to UTF-8 > and hence my web pages > are > > unable to render characters like the Trademark or > Copyright symbols. In > > Tomcat's source at various places teh character > encoding is hard-coded to > be > > ISO-8859-1. I have tried to use the filter in the > examples to set the > > encoding type but that did not help and I kept > seeing questionamarks for > > those characters. I have also tried to modify the > source and build again > but > > that doesn't work either (I know I must be doing > something wrong here.) > > > > Somehow tomcat doesn't allow me to change the > character encoding to UTF-8. > > The same JSPs are looking fine on Weblogic and > Resin without any > > configuration/modification to the server settings. > > > > Any ideas how can I fix this ugly problem in my > app. The app is unusable > > without this. > > > > Thanks a lot. > > > > Affan > > Here is my code for the Test JSP: > <%@page contentType="text/html; charset=UTF-8"%> > > Test JSP > > <% out.println('\u00A9'); %> > <% System.out.println("This © is test");%> > > <% out.println("This ° is test"); %> > > <% out.println("This © is test"); %> > > <% out.println("This \u00A9 is test"); %> <%= "©"%> > > <% out.println("This \u00B0 is test"); %> > > <% out.println("This \u00AE is test"); %> > > <% out.println("This \u0099 is test"); %> > > <% out.println("This \u00F6 is test"); %> > <% out.flush(); %> > > > > > - > To unsubscribe, e-mail: > [EMAIL PROTECTED] > For additional commands, e-mail: > [EMAIL PROTECTED] > __ Do you Yahoo!? Yahoo! Mail Plus - Powerful. Affordable. Sign up now. http://mailplus.yahoo.com - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Setting UTF-8 Encoding
I forgot to paste my code which is there at the bottom now. > I am having trouble setting the encoding to UTF-8 and hence my web pages are > unable to render characters like the Trademark or Copyright symbols. In > Tomcat's source at various places teh character encoding is hard-coded to be > ISO-8859-1. I have tried to use the filter in the examples to set the > encoding type but that did not help and I kept seeing questionamarks for > those characters. I have also tried to modify the source and build again but > that doesn't work either (I know I must be doing something wrong here.) > > Somehow tomcat doesn't allow me to change the character encoding to UTF-8. > The same JSPs are looking fine on Weblogic and Resin without any > configuration/modification to the server settings. > > Any ideas how can I fix this ugly problem in my app. The app is unusable > without this. > > Thanks a lot. > > Affan Here is my code for the Test JSP: <%@page contentType="text/html; charset=UTF-8"%> Test JSP <% out.println('\u00A9'); %> <% System.out.println("This © is test");%> <% out.println("This ° is test"); %> <% out.println("This © is test"); %> <% out.println("This \u00A9 is test"); %> <%= "©"%> <% out.println("This \u00B0 is test"); %> <% out.println("This \u00AE is test"); %> <% out.println("This \u0099 is test"); %> <% out.println("This \u00F6 is test"); %> <% out.flush(); %> - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Setting UTF-8 Encoding
I am having trouble setting the encoding to UTF-8 and hence my web pages are unable to render characters like the Trademark or Copyright symbols. In Tomcat's source at various places teh character encoding is hard-coded to be ISO-8859-1. I have tried to use the filter in the examples to set the encoding type but that did not help and I kept seeing questionamarks for those characters. I have also tried to modify the source and build again but that doesn't work either (I know I must be doing something wrong here.) Somehow tomcat doesn't allow me to change the character encoding to UTF-8. The same JSPs are looking fine on Weblogic and Resin without any configuration/modification to the server settings. Any ideas how can I fix this ugly problem in my app. The app is unusable without this. Thanks a lot. Affan - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]