Re: UTF-8 Encoding in Jsp | RESOLVED
I concur, thanks for posting your findings. Also if I may ask: please don't change the subject of your mails. Those of us who view this list as a newsgroup get all messed up! Andoni. - Original Message - From: "Shapira, Yoav" <[EMAIL PROTECTED]> Newsgroups: gmane.comp.jakarta.tomcat.user Sent: Thursday, December 02, 2004 2:08 PM Subject: RE: UTF-8 Encoding in Jsp | RESOLVED Hi, Thanks for posting your findings ;) Yoav Shapira http://www.yoavshapira.com >-Original Message- >From: Arnab Chakravarty [mailto:[EMAIL PROTECTED] >Sent: Thursday, December 02, 2004 9:03 AM >To: Tomcat Users List >Subject: RE: UTF-8 Encoding in Jsp | RESOLVED > >Hi all, > >First of all thanks to all the people who helped in the first place (I >am grateful). The problem was resolved and was due to some problem with >the home grown framework we were using with the application. > >Tomcat had nothing to do with the problem and content type is the only >thing required to make it work. As far as the database persistence was >concerned, oracle did no mistake in storing the data but when our >framework was persisting the values, it somehow corrupted the data >somewhere in the middle of submitting the page with non-english >characters and writing to the database. > >We found this problem by simply writing a simple jsp page without using >the framework and rendered some non-english characters successfully. > >Thanks again, >Arnab > > >-Original Message- >From: Arnab Chakravarty [mailto:[EMAIL PROTECTED] >Sent: Wednesday, December 01, 2004 4:08 PM >To: Tomcat Users List >Subject: RE: UTF-8 Encoding in Jsp > >Hi, > >Thanks for the reply but it did not work. May be I didn't explain the >problem correctly. > >I am running an application that supports all the languages but only in >some specific places of the application and I have made those places >UTF-8 complaint. > >Further, they are being saved to Database (Oracle 9). When we are >reading the data back from the database, junk characters are displayed >on the screen. Yes, the database is set to support UTF-8 Encoding and >this is working with the old version of tomcat 3.3 and not with current >upgraded version of tomcat 5.0 > >There are also places in the application where drop downs contain some >different language support and we can see those charsets (Japanese, >Chinese etc) appearing. Only, when I try to display on the screen >through the jsp file, I am encountering this problem of junk characters >begin displayed. > >Hope I have set more context around the problem. Please help me resolve >this issue. > >Thanks, >Arnab > >-Original Message- >From: Mariano [mailto:[EMAIL PROTECTED] >Sent: Wednesday, December 01, 2004 12:54 PM >To: 'Tomcat Users List' >Subject: RE: UTF-8 Encoding in Jsp > >You should use too: > > > > > >and this scriptlet: > > request.setCharacterEncoding("UTF-8"); > >at the beginning. > >I hope this help you > >-Mensaje original- >De: Arnab Chakravarty [mailto:[EMAIL PROTECTED] >Enviado el: martes, 30 de noviembre de 2004 15:28 >Para: Tomcat Users List >Asunto: UTF-8 Encoding in Jsp > > >Hi all, > >I need to make my all jsp files compatible with UTF-8 Encoding and even >though I am using the directives: > ><%@ page pageEncoding="UTF-8"%> ><%@ page contentType = "text/html;charset=UTF-8"%> > >in the jsp files, cannot make it work. > >Using tomcat version 5. Is there any config changes I need to make for >the UTF-8 Encoding to work. > >Please help. > >Thanks in advance, >Arnab > >- >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] This e-mail, including any attachments, is a confidential business communication, and may contain information that is confidential, proprietary and/or privileged. This e-mail is intended only for the individual(s) to whom it is addressed, and may not be saved, copied, printed, disclosed or used by anyone else. If you are not the(an) intended recipient, please immediately delete this e-mail from your computer system and notify the sender. Thank you. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: UTF-8 Encoding in Jsp | RESOLVED
Hi, Thanks for posting your findings ;) Yoav Shapira http://www.yoavshapira.com >-Original Message- >From: Arnab Chakravarty [mailto:[EMAIL PROTECTED] >Sent: Thursday, December 02, 2004 9:03 AM >To: Tomcat Users List >Subject: RE: UTF-8 Encoding in Jsp | RESOLVED > >Hi all, > >First of all thanks to all the people who helped in the first place (I >am grateful). The problem was resolved and was due to some problem with >the home grown framework we were using with the application. > >Tomcat had nothing to do with the problem and content type is the only >thing required to make it work. As far as the database persistence was >concerned, oracle did no mistake in storing the data but when our >framework was persisting the values, it somehow corrupted the data >somewhere in the middle of submitting the page with non-english >characters and writing to the database. > >We found this problem by simply writing a simple jsp page without using >the framework and rendered some non-english characters successfully. > >Thanks again, >Arnab > > >-Original Message- >From: Arnab Chakravarty [mailto:[EMAIL PROTECTED] >Sent: Wednesday, December 01, 2004 4:08 PM >To: Tomcat Users List >Subject: RE: UTF-8 Encoding in Jsp > >Hi, > >Thanks for the reply but it did not work. May be I didn't explain the >problem correctly. > >I am running an application that supports all the languages but only in >some specific places of the application and I have made those places >UTF-8 complaint. > >Further, they are being saved to Database (Oracle 9). When we are >reading the data back from the database, junk characters are displayed >on the screen. Yes, the database is set to support UTF-8 Encoding and >this is working with the old version of tomcat 3.3 and not with current >upgraded version of tomcat 5.0 > >There are also places in the application where drop downs contain some >different language support and we can see those charsets (Japanese, >Chinese etc) appearing. Only, when I try to display on the screen >through the jsp file, I am encountering this problem of junk characters >begin displayed. > >Hope I have set more context around the problem. Please help me resolve >this issue. > >Thanks, >Arnab > >-Original Message- >From: Mariano [mailto:[EMAIL PROTECTED] >Sent: Wednesday, December 01, 2004 12:54 PM >To: 'Tomcat Users List' >Subject: RE: UTF-8 Encoding in Jsp > >You should use too: > > > > > >and this scriptlet: > > request.setCharacterEncoding("UTF-8"); > >at the beginning. > >I hope this help you > >-Mensaje original- >De: Arnab Chakravarty [mailto:[EMAIL PROTECTED] >Enviado el: martes, 30 de noviembre de 2004 15:28 >Para: Tomcat Users List >Asunto: UTF-8 Encoding in Jsp > > >Hi all, > >I need to make my all jsp files compatible with UTF-8 Encoding and even >though I am using the directives: > ><%@ page pageEncoding="UTF-8"%> ><%@ page contentType = "text/html;charset=UTF-8"%> > >in the jsp files, cannot make it work. > >Using tomcat version 5. Is there any config changes I need to make for >the UTF-8 Encoding to work. > >Please help. > >Thanks in advance, >Arnab > >- >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] This e-mail, including any attachments, is a confidential business communication, and may contain information that is confidential, proprietary and/or privileged. This e-mail is intended only for the individual(s) to whom it is addressed, and may not be saved, copied, printed, disclosed or used by anyone else. If you are not the(an) intended recipient, please immediately delete this e-mail from your computer system and notify the sender. Thank you. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: UTF-8 Encoding in Jsp | RESOLVED
Hi all, First of all thanks to all the people who helped in the first place (I am grateful). The problem was resolved and was due to some problem with the home grown framework we were using with the application. Tomcat had nothing to do with the problem and content type is the only thing required to make it work. As far as the database persistence was concerned, oracle did no mistake in storing the data but when our framework was persisting the values, it somehow corrupted the data somewhere in the middle of submitting the page with non-english characters and writing to the database. We found this problem by simply writing a simple jsp page without using the framework and rendered some non-english characters successfully. Thanks again, Arnab -Original Message- From: Arnab Chakravarty [mailto:[EMAIL PROTECTED] Sent: Wednesday, December 01, 2004 4:08 PM To: Tomcat Users List Subject: RE: UTF-8 Encoding in Jsp Hi, Thanks for the reply but it did not work. May be I didn't explain the problem correctly. I am running an application that supports all the languages but only in some specific places of the application and I have made those places UTF-8 complaint. Further, they are being saved to Database (Oracle 9). When we are reading the data back from the database, junk characters are displayed on the screen. Yes, the database is set to support UTF-8 Encoding and this is working with the old version of tomcat 3.3 and not with current upgraded version of tomcat 5.0 There are also places in the application where drop downs contain some different language support and we can see those charsets (Japanese, Chinese etc) appearing. Only, when I try to display on the screen through the jsp file, I am encountering this problem of junk characters begin displayed. Hope I have set more context around the problem. Please help me resolve this issue. Thanks, Arnab -Original Message- From: Mariano [mailto:[EMAIL PROTECTED] Sent: Wednesday, December 01, 2004 12:54 PM To: 'Tomcat Users List' Subject: RE: UTF-8 Encoding in Jsp You should use too: and this scriptlet: request.setCharacterEncoding("UTF-8"); at the beginning. I hope this help you -Mensaje original- De: Arnab Chakravarty [mailto:[EMAIL PROTECTED] Enviado el: martes, 30 de noviembre de 2004 15:28 Para: Tomcat Users List Asunto: UTF-8 Encoding in Jsp Hi all, I need to make my all jsp files compatible with UTF-8 Encoding and even though I am using the directives: <%@ page pageEncoding="UTF-8"%> <%@ page contentType = "text/html;charset=UTF-8"%> in the jsp files, cannot make it work. Using tomcat version 5. Is there any config changes I need to make for the UTF-8 Encoding to work. Please help. Thanks in advance, Arnab - 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: UTF-8 Encoding in Jsp
I would recommend that you make the Entire Site UTF-8. The parts that are in English will still work no problem but I would really not try mixing the encoding for requests. The "junk characters" you are getting back are also not actually junk. You can work out what encoding is being used by interpreting these string and knowing what the intended string is. Also the fact that you are not just getting lots of "?" characters means that it is not Oracle that is having the problem. I will read the other reply when I get a chance and see if I have any further contributions but for now I really strenuously suggest making ALL the pages/servlets UTF-8. Regards, Andoni. - Original Message - From: "Arnab Chakravarty" <[EMAIL PROTECTED]> Newsgroups: gmane.comp.jakarta.tomcat.user Sent: Wednesday, December 01, 2004 10:37 AM Subject: RE: UTF-8 Encoding in Jsp Hi, Thanks for the reply but it did not work. May be I didn't explain the problem correctly. I am running an application that supports all the languages but only in some specific places of the application and I have made those places UTF-8 complaint. Further, they are being saved to Database (Oracle 9). When we are reading the data back from the database, junk characters are displayed on the screen. Yes, the database is set to support UTF-8 Encoding and this is working with the old version of tomcat 3.3 and not with current upgraded version of tomcat 5.0 There are also places in the application where drop downs contain some different language support and we can see those charsets (Japanese, Chinese etc) appearing. Only, when I try to display on the screen through the jsp file, I am encountering this problem of junk characters begin displayed. Hope I have set more context around the problem. Please help me resolve this issue. Thanks, Arnab -Original Message- From: Mariano [mailto:[EMAIL PROTECTED] Sent: Wednesday, December 01, 2004 12:54 PM To: 'Tomcat Users List' Subject: RE: UTF-8 Encoding in Jsp You should use too: and this scriptlet: request.setCharacterEncoding("UTF-8"); at the beginning. I hope this help you -Mensaje original- De: Arnab Chakravarty [mailto:[EMAIL PROTECTED] Enviado el: martes, 30 de noviembre de 2004 15:28 Para: Tomcat Users List Asunto: UTF-8 Encoding in Jsp Hi all, I need to make my all jsp files compatible with UTF-8 Encoding and even though I am using the directives: <%@ page pageEncoding="UTF-8"%> <%@ page contentType = "text/html;charset=UTF-8"%> in the jsp files, cannot make it work. Using tomcat version 5. Is there any config changes I need to make for the UTF-8 Encoding to work. Please help. Thanks in advance, Arnab - 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: UTF-8 Encoding in Jsp
Hi, These encoding issues are always a nightmare ;) There are some relevant areas of the Servlet spec you may want to look at wrt encoding, notably (Internationalization and Request data encoding). In terms of UTF-8 not coming back correctly from your database you need to ensure that when they were _added_ that the character encoding was UTF-8. You should also verify yuor database is in UTF-8 mode. If both these statements are true, then you need to read Internationalization in the Servlet spec which says "If the servlet does not specify a character encoding before the getWriter method of the ServletResponse interface is called or the response is committed, the default ISO-8859-1 is used." In other words, you need to call setLocale or setCharacterEncoding before the response is committed. I am not entirely sure whether that is actually what that JSP page directive is doing, maybe it is. Perhaps in your JSP you can output <%= request.getCharacterEncoding() %> to make sure your UTF-8 has been set. If it is null, it has not been set. If it _is_ UTF-8 then the character data is either not actually UTF-8 coming from the database either because a) your database driver connection URL is not operating in UTF-8 mode, b) the data when put into the database was not UTF-8 or c) the database is not running UTF-8. In terms of sending data to the database as UTF-8 check your driver parameters (normally on the URL string) and also database setting. You also need to take note of this section of the Servlet spec. We had to write a servlet filter to change our inbound form posts to the correct encoding for our database Cp1252. Request data encoding extract The default encoding of a request the container uses to create the request reader and parse POST data must be ISO-8859-1 if none has been specified by the client request. However, in order to indicate to the developer in this case the failure of the client to send a character encoding, the container returns null from the getCharacterEncoding method. If the client hasn't set character encoding and the request data is encoded with a different encoding than the default as described above, breakage can occur. To remedy this situation, a new method setCharacterEncoding(String enc) has been added to the ServletRequest interface. Developers can override the character encoding supplied by the container by calling this method. It must be called prior to parsing any post data or reading any input from the request. Hope this info gets you thinking, Allistair. > -Original Message- > From: Arnab Chakravarty [mailto:[EMAIL PROTECTED] > Sent: 01 December 2004 10:38 > To: Tomcat Users List > Subject: RE: UTF-8 Encoding in Jsp > > > Hi, > > Thanks for the reply but it did not work. May be I didn't explain the > problem correctly. > > I am running an application that supports all the languages > but only in > some specific places of the application and I have made those places > UTF-8 complaint. > > Further, they are being saved to Database (Oracle 9). When we are > reading the data back from the database, junk characters are displayed > on the screen. Yes, the database is set to support UTF-8 Encoding and > this is working with the old version of tomcat 3.3 and not > with current > upgraded version of tomcat 5.0 > > There are also places in the application where drop downs contain some > different language support and we can see those charsets (Japanese, > Chinese etc) appearing. Only, when I try to display on the screen > through the jsp file, I am encountering this problem of junk > characters > begin displayed. > > Hope I have set more context around the problem. Please help > me resolve > this issue. > > Thanks, > Arnab > > -Original Message- > From: Mariano [mailto:[EMAIL PROTECTED] > Sent: Wednesday, December 01, 2004 12:54 PM > To: 'Tomcat Users List' > Subject: RE: UTF-8 Encoding in Jsp > > You should use too: > > > > > > and this scriptlet: > > request.setCharacterEncoding("UTF-8"); > > at the beginning. > > I hope this help you > > -Mensaje original- > De: Arnab Chakravarty [mailto:[EMAIL PROTECTED] > Enviado el: martes, 30 de noviembre de 2004 15:28 > Para: Tomcat Users List > Asunto: UTF-8 Encoding in Jsp > > > Hi all, > > I need to make my all jsp files compatible with UTF-8 > Encoding and even > though I am using the directives: > > <%@ page pageEncoding="UTF-8"%> > <%@ page contentType = "text/html;charset=UTF-8"%> > > in the jsp files, cannot make it work. > > Using tomcat version 5. Is there any config changes I need to make for > the UTF-8 Encoding to work. > &
RE: UTF-8 Encoding in Jsp
Hi, Thanks for the reply but it did not work. May be I didn't explain the problem correctly. I am running an application that supports all the languages but only in some specific places of the application and I have made those places UTF-8 complaint. Further, they are being saved to Database (Oracle 9). When we are reading the data back from the database, junk characters are displayed on the screen. Yes, the database is set to support UTF-8 Encoding and this is working with the old version of tomcat 3.3 and not with current upgraded version of tomcat 5.0 There are also places in the application where drop downs contain some different language support and we can see those charsets (Japanese, Chinese etc) appearing. Only, when I try to display on the screen through the jsp file, I am encountering this problem of junk characters begin displayed. Hope I have set more context around the problem. Please help me resolve this issue. Thanks, Arnab -Original Message- From: Mariano [mailto:[EMAIL PROTECTED] Sent: Wednesday, December 01, 2004 12:54 PM To: 'Tomcat Users List' Subject: RE: UTF-8 Encoding in Jsp You should use too: and this scriptlet: request.setCharacterEncoding("UTF-8"); at the beginning. I hope this help you -Mensaje original- De: Arnab Chakravarty [mailto:[EMAIL PROTECTED] Enviado el: martes, 30 de noviembre de 2004 15:28 Para: Tomcat Users List Asunto: UTF-8 Encoding in Jsp Hi all, I need to make my all jsp files compatible with UTF-8 Encoding and even though I am using the directives: <%@ page pageEncoding="UTF-8"%> <%@ page contentType = "text/html;charset=UTF-8"%> in the jsp files, cannot make it work. Using tomcat version 5. Is there any config changes I need to make for the UTF-8 Encoding to work. Please help. Thanks in advance, Arnab - 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: UTF-8 Encoding in Jsp
You should use too: and this scriptlet: request.setCharacterEncoding("UTF-8"); at the beginning. I hope this help you -Mensaje original- De: Arnab Chakravarty [mailto:[EMAIL PROTECTED] Enviado el: martes, 30 de noviembre de 2004 15:28 Para: Tomcat Users List Asunto: UTF-8 Encoding in Jsp Hi all, I need to make my all jsp files compatible with UTF-8 Encoding and even though I am using the directives: <%@ page pageEncoding="UTF-8"%> <%@ page contentType = "text/html;charset=UTF-8"%> in the jsp files, cannot make it work. Using tomcat version 5. Is there any config changes I need to make for the UTF-8 Encoding to work. Please help. Thanks in advance, Arnab - 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: UTF-8 Encoding in Jsp
Hello, First and foremost I would say: be absolutely sure that it is the JSP's fault. I hope you are not getting some data from a database and trying to show it? Be sure that your editor is saving the JSP in UTF-8 format. Add the flag: -Dfile.encoding=UTF-8 to the CATALINA_OPTS environment variable in your catalina.bat (or equivalent) startup file. and use: req.setCharacterEncoding("UTF-8"); to set the encoding on the request. This may help: http://marc.theaimsgroup.com/?l=tomcat-user&m=105524550416364&w=2 Though you can ignore the method wich is used to set the encoding as the above line does the same job in servlets. Andoni. - Original Message - From: "Arnab Chakravarty" <[EMAIL PROTECTED]> Newsgroups: gmane.comp.jakarta.tomcat.user Sent: Tuesday, November 30, 2004 2:28 PM Subject: UTF-8 Encoding in Jsp Hi all, I need to make my all jsp files compatible with UTF-8 Encoding and even though I am using the directives: <%@ page pageEncoding="UTF-8"%> <%@ page contentType = "text/html;charset=UTF-8"%> in the jsp files, cannot make it work. Using tomcat version 5. Is there any config changes I need to make for the UTF-8 Encoding to work. Please help. Thanks in advance, Arnab - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]