serving file name in unicode
hi there, im facing problem in tomcat serving a file with unicode name. pls help in this regard thanks in advance, arun
unicode ??
Hi I have a stupid question to ask. Does Tomcat 5.5 supports UTF-8 encoding format ? thanks regards Gaurav Arora __ Do you Yahoo!? Yahoo! Small Business - Try our new resources site! http://smallbusiness.yahoo.com/resources/ - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: unicode ??
yup -Tim Gaurav Arora wrote: Hi I have a stupid question to ask. Does Tomcat 5.5 supports UTF-8 encoding format ? - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Retrieveing Unicode stuff from MySQL 4.1.x ?
I tried to use table with CHARACTER SET UTF8, but it didn't change anything :( Any other suggestions? -Original Message- From: Koon Yue Lam [mailto:[EMAIL PROTECTED] Sent: Tuesday, July 13, 2004 9:50 PM To: Tomcat Users List Subject: Re: Retrieveing Unicode stuff from MySQL 4.1.x ? http://dev.mysql.com/doc/mysql/en/Charset-defaults.html in your case, u just define everything as unicode, so just set the database encoding to unicode hopes this help - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] --- Incoming mail is certified Virus Free. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.716 / Virus Database: 472 - Release Date: 05.07.2004 --- Outgoing mail is certified Virus Free. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.716 / Virus Database: 472 - Release Date: 05.07.2004 - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Retrieveing Unicode stuff from MySQL 4.1.x ?
Ivan Jouikov wrote: I tried to use table with CHARACTER SET UTF8, but it didn't change anything :( Any other suggestions? I'm using a line like the one below to connect to the MySQL DB and it is working quite well here: DBUrl=jdbc:mysql://+server+:+databaseport+/+database+?user=+login+password=+password+useUnicode=truecharacterEncoding=UTF-8; You may want to specify characterSetResults as well. http://dev.mysql.com/doc/connector/j/en/index.html Andr. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Retrieveing Unicode stuff from MySQL 4.1.x ?
I tried using those URL parameters. Doesn't change anything. -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Sent: Wednesday, July 14, 2004 2:30 AM To: Tomcat Users List Subject: Re: Retrieveing Unicode stuff from MySQL 4.1.x ? Ivan Jouikov wrote: I tried to use table with CHARACTER SET UTF8, but it didn't change anything :( Any other suggestions? I'm using a line like the one below to connect to the MySQL DB and it is working quite well here: DBUrl=jdbc:mysql://+server+:+databaseport+/+database+?user=+login+ password=+password+useUnicode=truecharacterEncoding=UTF-8; You may want to specify characterSetResults as well. http://dev.mysql.com/doc/connector/j/en/index.html Andre. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] --- Incoming mail is certified Virus Free. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.716 / Virus Database: 472 - Release Date: 05.07.2004 --- Outgoing mail is certified Virus Free. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.716 / Virus Database: 472 - Release Date: 05.07.2004 - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Retrieveing Unicode stuff from MySQL 4.1.x ?
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Ivan Jouikov wrote: | I tried using those URL parameters. Doesn't change anything. | | |-Original Message- |From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] |Sent: Wednesday, July 14, 2004 2:30 AM |To: Tomcat Users List |Subject: Re: Retrieveing Unicode stuff from MySQL 4.1.x ? | |Ivan Jouikov wrote: | |I tried to use table with CHARACTER SET UTF8, but it didn't change | |anything :( | |Any other suggestions? | |I'm using a line like the one below to connect to the MySQL DB and it is |working quite well here: | |DBUrl=jdbc:mysql://+server+:+databaseport+/+database+?user=+login+ |password=+password+useUnicode=truecharacterEncoding=UTF-8; | |You may want to specify characterSetResults as well. | |http://dev.mysql.com/doc/connector/j/en/index.html Ivan, You're going to have to do a little testing to see _where_ the character encoding is being lost. You should first see if the strings that you are inserting into the database are the same as being retrieved, either in your JSP, or in a little testcase (I prefer JUnit myself), by using String's .equals() method and not your 'eyes'. The reason to do this is to isolate the different stages of encoding/decoding from each other, because there's an encoding/decoding between the JDBC driver and the database, there is one yet again between your JSP and your browser, and there is many times one yet again between your browser and your operating system. You will need to check at _each_ stage to make sure that the characters are encoded the way you think they are. I can state from experience that _usually_ it's not at the database level, however, it's usually a mismatch somewhere else that these problems occur (but they are hard to debug sometimes :( ) Regards, -Mark - -- Mr. Mark Matthews MySQL AB, Software Development Manager, J2EE and Windows Platforms Office: +1 708 332 0507 www.mysql.com MySQL Guide to Lower TCO http://www.mysql.com/it-resources/white-papers/tco.php -BEGIN PGP SIGNATURE- Version: GnuPG v1.2.3 (MingW32) Comment: Using GnuPG with Thunderbird - http://enigmail.mozdev.org iD8DBQFA9U22tvXNTca6JD8RAibYAKDHK+QwHHPXuwK8COGp1XhxRM1s7wCdFmIf yxc3AlFTMt9LWvRxYdXwMoM= =6oIc -END PGP SIGNATURE- - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Retrieveing Unicode stuff from MySQL 4.1.x ?
Yes, I can't agree with this more u need to do sdome testing, use JUnit if u can But I would prefer not only use String.equals, but actually print out the HEX value of the string u need to print out the HEX value in: Just before the JSP form start submit when the action start process the form just before any database process after that, goto Mysql console and print out the HEX value that u just insert of update and do the same when u retrieve that value from database in any case, all the above HEX values should be the same I know it is ignoring but many people go throught this, sometimes ago I have the exact problem like this when I use Mysql + PHP + SQL Server to do database sync. Regards - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Retrieveing Unicode stuff from MySQL 4.1.x ?
Hey! Im trying to make it so that my clients could use different languages when entering stuff into my froms. What I am doing right now is: All my pages have %@ page language=java contentType=text/html; charset=UTF-8 at the top When I retrieve parameters I use the following procedure: String text = request.getParameter(text); text = new String(text.getBytes(8859_1),UTF8); This seems to work perfectly for throwing parameters from page to page. Also, it seems to work fine to ENTER stuff into MySQL (I look at mysql through GUI client, and I can see all my Unicode stuff correctly). However, what is troubling me, is that when I retrieve that Unicode stuff from DB and try to display it, I get a whole bunch of junk on my page. Heres how I retrieve it: /** * Returns a list containing GuestBookEntry's ordered by date. * @param page from which page (page 1: entries 1 thru 5) * @return a list containing GuestBookEntry's ordered by date, empty list if none. */ public static List getEntries( int page ) throws SQLException { Connection con = null; PreparedStatement st = null; ResultSet rs = null; List entries = new LinkedList(); if ( page 1 ) throw new IllegalArgumentException(Page must be 1 or above!); int startIndex = (page-1)*offset; try { con = Manager.getInstance().getConnection(); st = con.prepareStatement(SELECT name,email,date,IP,message FROM GuestBook ORDER BY date DESC LIMIT ?,?); st.setInt(1,startIndex); st.setInt(2,offset); rs = st.executeQuery(); while ( rs.next() ) { String name = rs.getString(1); String email = rs.getString(2); String IP = rs.getString(4); String message = rs.getString(5); Timestamp date = rs.getTimestamp(3); GuestBookEntry e = new GuestBookEntry(name,email,IP,message,date); entries.add(e); } } finally { try{ if ( con != null ) con.close(); } catch(SQLException e){ Logger.getLogger(problem).error(Can't close Connection!,e); } } return entries; } And in my JSP page I simply display name and message from the list returned by this function Does anyone know how to make my JSP page display my stuff correctly? I also tried doing: %= new String(message.getBytes(8859_1),UTF8) % But that just gives me a whole bunch of boxes instead of text. Any help is greatly appreciated. Best Regards, Ivan V. Jouikov (206) 228-6670 --- Outgoing mail is certified Virus Free. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.716 / Virus Database: 472 - Release Date: 05.07.2004
Re: Retrieveing Unicode stuff from MySQL 4.1.x ?
Hi, I am not en expert, just some piece of advice I know from MySql 4.01, u can define the character encoding on each database, table and column. Are u sure your column is encoded in unicode? Because the GUI client may smart enought to auto convert the encoding, so u can view the character properly but becomes boxes when retrieve. Regards - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Retrieveing Unicode stuff from MySQL 4.1.x ?
Hmm any idea how to define that? -Original Message- From: Koon Yue Lam [mailto:[EMAIL PROTECTED] Sent: Tuesday, July 13, 2004 9:34 PM To: Tomcat Users List Subject: Re: Retrieveing Unicode stuff from MySQL 4.1.x ? Hi, I am not en expert, just some piece of advice I know from MySql 4.01, u can define the character encoding on each database, table and column. Are u sure your column is encoded in unicode? Because the GUI client may smart enought to auto convert the encoding, so u can view the character properly but becomes boxes when retrieve. Regards - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] --- Incoming mail is certified Virus Free. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.716 / Virus Database: 472 - Release Date: 05.07.2004 --- Outgoing mail is certified Virus Free. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.716 / Virus Database: 472 - Release Date: 05.07.2004 - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Retrieveing Unicode stuff from MySQL 4.1.x ?
http://dev.mysql.com/doc/mysql/en/Charset-defaults.html in your case, u just define everything as unicode, so just set the database encoding to unicode hopes this help - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Tomcat/JDBC/Unicode
I'm having a rather strange problem that I'm hoping someone can help me with. I'm using Struts 1.0/jsp on Debian linux under Tomcat 4.1.x and the blackdown JVM against PostgreSQL 7.3.2 . I'm attempting to convert my current SQL_ASCII database to UNICODE. I'm new to this, so am most likely making a few mistakes. Here's what I've done so far: o Converted database encoding to be UNICODE. I'm pretty sure this part worked okay. (did a pg_dump, then iconv -f 8859_1 -t UTF-8, then created new db with encoding UNICODE and reloaded- no errors upon reload) sparky:~$ psql -l List of databases Name| Owner | Encoding ---+--+--- unitest | kurt | UNICODE template1 | postgres | SQL_ASCII (2 rows) o set client_encoding to 'UTF8'; o In my JSP files, I set the following at the top of each: %@ page lanuage=java pageEncoding=UTF-8 % Now, to test this, I go to a japanese page, copy some text, then paste it into a form, that gets submitted to the server and saved into the DB. Then I try to display what I got back from the database. It comes out garbled. HOWEVER- if I leave the 'pageEncoding' out of my display .jsp file it still comes out garbled, UNTIL I set UTF-8 manually in my browsers Character Encoding settings (both mozilla and IE). Then the japanese characters render fine (just like I entered them). Very strange. What's confusing is that when I set the pageEncoding to 'UTF-8', the characters don't render properly, and as far as I can tell, thats the same as manually setting the browser manually. I must be doing something wrong because I get the same results in IE and mozilla (recent build). What may be the problem- I don't do anything differently when getting the data out of the database, just standard resultset.getString(column); Do I need to change that call, to handle the potentially UTF-8 encoded strings? I can't find anything on that at all with google/usenet. Any and all help, suggestions or pointers would be greatly appreciated. Thanks! /kurt - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Simple question on Unicode URL in Tomcat
Dear all: I have a simple question regarding to the Unicode URL support in Tomcat. If I pass a Unicode URL to Tomcat, can it retrieve the targeted content? Some of our web pages are named under double byte characters. We have tried various ways but all have failed. If you have a work around, please let us know. Many thanks. John
Does Tomcat support Unicode URL
We still have not figure out a way to resolve doublebyte URL's with Tomcat. I.E. if we have an jsp or htm file name which is in Unicode, it seems that tomcat has no way to load that page. We tried to encode the characters with % URL encoding, but seems not working. Can anyone help? Thanks. John
RE: Does Tomcat support Unicode URL
Well Java 1.4 does. Did you try something like: %=URLEncoder.encode(s, enc)% s is your URL and enc is the java encoding such as Shift_JIS. See URLEncoder for more info. Will work from java 1.4 I believe. Had the same problem and this seems to solve it just fine. I had to set the correct encoding though. -- We tried to encode the characters with % URL encoding, but seems not working. Can anyone help? Thanks. John -- Shawn Happily using M2, Opera's revolutionary e-mail client: http://www.opera.com/m2/ - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Simple question on Unicode URL in Tomcat
Dear all: I have a simple question regarding to the Unicode URL support in Tomcat. If I pass a Unicode URL to Tomcat, can it retrieve the targeted content? Some of our web pages are named under double byte characters. We have tried various ways to make it work but all failed. If you have a work around, please let us know. Many thanks. John
Re: Simple question on Unicode URL in Tomcat
Hiho, try something like: String s = URLEncoder.encode(s, enc); s is your URL and enc is the java encoding such as Shift_JIS. See URLEncoder for more info. Will work from java 1.4 I believe. Had the same problem and this seems to solve it just fine. -- Shawn Happily using M2, Opera's revolutionary e-mail client: http://www.opera.com/m2/ - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: handling of Unicode still broken in 4.1.24
You could try setting your file.encoding system property. That might help. Sun changed the default value for this property in JDK1.4 On *nix systems it changed from ISO-8859-1 to ASCII. Andy -Original Message- From: Carole Mah [mailto:[EMAIL PROTECTED] Sent: 26 March 2003 17:19 To: [EMAIL PROTECTED] Subject: handling of Unicode still broken in 4.1.24 Hello, I've been using Tomcat 4.0.6 for some time now, because neither 4.1.12 nor 4.1.18 handled my Unicode correctly. When 4.1.18 came out, my co-worker Paul Caton posted to this list asking for help on this issue. I had supposed by now the issue would have been solved, so I cheerily and with much anticipation installed 4.1.24. However, the unicode handling is still bad in 4.1.24, so we are sticking with 4.0.6. We're wondering if this issue is going to be addressed in future releases. I am willing to send the actual URLs of the tomcat servers on which the test documents reside to any developer who wants them, but I'd rather not post those URLs to the public at large. I can also send any jsp code, xsl stylesheets, Xinclude stuff, etc. In lieu of that here, I'll just give the URLs of two comparative screenshots to show the differences in the Unicode handling: bad: http://dev.stg.brown.edu/screenshots/acsam-4.1.24.jpg good: http://dev.stg.brown.edu/screenshots/acsam-4.0.6.jpg Thank you very much for any help with this! -carole -- Carole E. Mah [EMAIL PROTECTED] Senior Programmer/Analyst Brown University Computing Information Services Academic Technology Services Scholarly Technology Group phn 401-863-2669 fax 401-863-9313 http://www.stg.brown.edu/ - 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]
handling of Unicode still broken in 4.1.24
Hello, I've been using Tomcat 4.0.6 for some time now, because neither 4.1.12 nor 4.1.18 handled my Unicode correctly. When 4.1.18 came out, my co-worker Paul Caton posted to this list asking for help on this issue. I had supposed by now the issue would have been solved, so I cheerily and with much anticipation installed 4.1.24. However, the unicode handling is still bad in 4.1.24, so we are sticking with 4.0.6. We're wondering if this issue is going to be addressed in future releases. I am willing to send the actual URLs of the tomcat servers on which the test documents reside to any developer who wants them, but I'd rather not post those URLs to the public at large. I can also send any jsp code, xsl stylesheets, Xinclude stuff, etc. In lieu of that here, I'll just give the URLs of two comparative screenshots to show the differences in the Unicode handling: bad: http://dev.stg.brown.edu/screenshots/acsam-4.1.24.jpg good: http://dev.stg.brown.edu/screenshots/acsam-4.0.6.jpg Thank you very much for any help with this! -carole -- Carole E. Mah [EMAIL PROTECTED] Senior Programmer/Analyst Brown University Computing Information Services Academic Technology Services Scholarly Technology Group phn 401-863-2669 fax 401-863-9313 http://www.stg.brown.edu/ - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: handling of Unicode still broken in 4.1.24
Post a bug to bugzilla... http://nagoya.apache.org/bugzilla/ Or, if one already exists there, comment on that and raise the priority. Jake At 12:19 PM 3/26/2003 -0500, you wrote: Hello, I've been using Tomcat 4.0.6 for some time now, because neither 4.1.12 nor 4.1.18 handled my Unicode correctly. When 4.1.18 came out, my co-worker Paul Caton posted to this list asking for help on this issue. I had supposed by now the issue would have been solved, so I cheerily and with much anticipation installed 4.1.24. However, the unicode handling is still bad in 4.1.24, so we are sticking with 4.0.6. We're wondering if this issue is going to be addressed in future releases. I am willing to send the actual URLs of the tomcat servers on which the test documents reside to any developer who wants them, but I'd rather not post those URLs to the public at large. I can also send any jsp code, xsl stylesheets, Xinclude stuff, etc. In lieu of that here, I'll just give the URLs of two comparative screenshots to show the differences in the Unicode handling: bad: http://dev.stg.brown.edu/screenshots/acsam-4.1.24.jpg good: http://dev.stg.brown.edu/screenshots/acsam-4.0.6.jpg Thank you very much for any help with this! -carole -- Carole E. Mah [EMAIL PROTECTED] Senior Programmer/Analyst Brown University Computing Information Services Academic Technology Services Scholarly Technology Group phn 401-863-2669 fax 401-863-9313 http://www.stg.brown.edu/ - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Where did my Unicode go in 4.1.17?
I think I need the help of outside eyes, because I must be not seeing the forest for the trees. Under Tomcat 4.0.6 I was serving out XML which had Unicode code points for Arabic characters and in all decent browsers (Mozilla, Phoenix, Chimera, etc.) the Arabic displayed beautifully. Yesterday we updated to Tomcat 4.1.17: none of the data files changed, none of the XSL files changed, none of our server settings changed. Under the new Tomcat everything seemed to be as before except ... the beautiful Arabic has gone and in its place is that gobbledegook of squares, at-signs, etc. that browsers give when they don't know what else to do. When I use Mozilla to look at the XML file that the JSP is importing I can see that the Unicode is definitely there and displays fine, so the problem must be occurring after Tomcat gets hold of it. After reading Bill Barker's response to someone else's query yesterday I specifically added charset=UTF-8 to the %@ page contentType=text/xml % that I previously had, but still no Arabic. I couldn't find anything in the RELEASE-NOTES-4.1.txt that looked relevant. Has something changed between 4.0.6 and 4.1.17 that would explain my vanished Arabic? Thanks, Paul. -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
RE: Tomcat and Unicode parameters in URLs ???
Thanks for pointing this out Larry. Unfortunately we use Tomcat 4 only because it seems quite a bit faster than the Tomcat 3 series. Thank you though. It looks like I'm going to have to learn how to guess the character set and language. Thank you, Soefara. From: Larry Isaacs [EMAIL PROTECTED] Reply-To: Tomcat Users List [EMAIL PROTECTED] To: 'Tomcat Users List' [EMAIL PROTECTED] Subject: RE: Tomcat and Unicode parameters in URLs ??? Date: Tue, 19 Mar 2002 07:51:46 -0500 If you can live with the Servlet 2.2 spec, Tomcat 3.3 has a work around for this. The DecodeInterceptor can accept a URL like the following to specify the encoding as part of the URI: http://localhost:8080/myapp/index.jsp;charset=UTF-8?param=value For details, see the charsetAttribute attribute of the DecodeInterceptor: http://jakarta.apache.org/tomcat/tomcat-3.3-doc/serverxml.html#DecodeInterceptor You are welcome to give it a try. Cheers, Larry -Original Message- From: Craig R. McClanahan [mailto:[EMAIL PROTECTED]] Sent: Monday, March 18, 2002 8:50 PM To: Tomcat Users List Subject: Re: Tomcat and Unicode parameters in URLs ??? On Tue, 19 Mar 2002, Soefara Redzuan wrote: Date: Tue, 19 Mar 2002 09:20:47 +0800 From: Soefara Redzuan [EMAIL PROTECTED] Reply-To: Tomcat Users List [EMAIL PROTECTED] To: [EMAIL PROTECTED] Subject: Re: Tomcat and Unicode parameters in URLs ??? Setting the content type, as you did above, only affects the *output* of that particular response -- it has nothing to do with how the next *input* request from that browser will be handled. In order to deal with request parameters in an incoming request, you must tell Tomcat what encoding to use, *before* processing the parameters. This is done by calling the request.setCharacterEncoding() method that was added in Servlet 2.3. As long as you call this before calling methods like request.getParameter(), the proper encoding will be applied. One way to do this without modifying your application itself is to use a Filter that looks at incoming requests and decides what encoding should be used -- perhaps by looking at the codeAccept-Language/code header, or based on attributes you have stored in the current session that indicate what the user will be supplying. But what happens if you really do not know what character set to expect ? In our company, the webserver is used for B2B messaging with customers and not purely serving web pages. For example, we can accept a message with a query string like this http://vpn.ourcompany.com/servlet/incoming? company=CustomerNamerefere nceId=1234noteText= The noteText could be in one of several languages since we do international business. We're currently considering adding a language parameter such as Language=English but it would be nicer to autodetect the language. Is this possible ? It would be possible if the HTTP specs defined a way to tell the server what language the HTTP URL is encoded in, and if browsers actually sent along that indication. Neither seems to be the case in general -- even on a POST transaction (where the browsers really have no excuse for not including the character encoding in the Content-Type header), many don't. Thus, you're stuck haveing to figure it out for yourself. Note that adding a language parameter to the query string isn't going to do you much good -- you have to call setCharacterEncoding() *before* you call request.getParameter(), so you won't have been able to read the language field first. Thank you, Soefara _ Craig Join the world's largest e-mail service with MSN Hotmail. http://www.hotmail.com -- To unsubscribe: mailto:tomcat-user- [EMAIL PROTECTED] For additional commands: mailto:[EMAIL PROTECTED] Troubles with the list: mailto:[EMAIL PROTECTED] -- To unsubscribe: mailto:[EMAIL PROTECTED] For additional commands: mailto:[EMAIL PROTECTED] Troubles with the list: mailto:[EMAIL PROTECTED] -- To unsubscribe: mailto:[EMAIL PROTECTED] For additional commands: mailto:[EMAIL PROTECTED] Troubles with the list: mailto:[EMAIL PROTECTED] _ Chat with friends online, try MSN Messenger: http://messenger.msn.com -- To unsubscribe: mailto:[EMAIL PROTECTED] For additional commands: mailto:[EMAIL PROTECTED] Troubles with the list: mailto:[EMAIL PROTECTED]
RE: Tomcat and Unicode parameters in URLs ???
If you can live with the Servlet 2.2 spec, Tomcat 3.3 has a work around for this. The DecodeInterceptor can accept a URL like the following to specify the encoding as part of the URI: http://localhost:8080/myapp/index.jsp;charset=UTF-8?param=value For details, see the charsetAttribute attribute of the DecodeInterceptor: http://jakarta.apache.org/tomcat/tomcat-3.3-doc/serverxml.html#DecodeInterceptor You are welcome to give it a try. Cheers, Larry -Original Message- From: Craig R. McClanahan [mailto:[EMAIL PROTECTED]] Sent: Monday, March 18, 2002 8:50 PM To: Tomcat Users List Subject: Re: Tomcat and Unicode parameters in URLs ??? On Tue, 19 Mar 2002, Soefara Redzuan wrote: Date: Tue, 19 Mar 2002 09:20:47 +0800 From: Soefara Redzuan [EMAIL PROTECTED] Reply-To: Tomcat Users List [EMAIL PROTECTED] To: [EMAIL PROTECTED] Subject: Re: Tomcat and Unicode parameters in URLs ??? Setting the content type, as you did above, only affects the *output* of that particular response -- it has nothing to do with how the next *input* request from that browser will be handled. In order to deal with request parameters in an incoming request, you must tell Tomcat what encoding to use, *before* processing the parameters. This is done by calling the request.setCharacterEncoding() method that was added in Servlet 2.3. As long as you call this before calling methods like request.getParameter(), the proper encoding will be applied. One way to do this without modifying your application itself is to use a Filter that looks at incoming requests and decides what encoding should be used -- perhaps by looking at the codeAccept-Language/code header, or based on attributes you have stored in the current session that indicate what the user will be supplying. But what happens if you really do not know what character set to expect ? In our company, the webserver is used for B2B messaging with customers and not purely serving web pages. For example, we can accept a message with a query string like this http://vpn.ourcompany.com/servlet/incoming? company=CustomerNamerefere nceId=1234noteText= The noteText could be in one of several languages since we do international business. We're currently considering adding a language parameter such as Language=English but it would be nicer to autodetect the language. Is this possible ? It would be possible if the HTTP specs defined a way to tell the server what language the HTTP URL is encoded in, and if browsers actually sent along that indication. Neither seems to be the case in general -- even on a POST transaction (where the browsers really have no excuse for not including the character encoding in the Content-Type header), many don't. Thus, you're stuck haveing to figure it out for yourself. Note that adding a language parameter to the query string isn't going to do you much good -- you have to call setCharacterEncoding() *before* you call request.getParameter(), so you won't have been able to read the language field first. Thank you, Soefara _ Craig Join the world's largest e-mail service with MSN Hotmail. http://www.hotmail.com -- To unsubscribe: mailto:tomcat-user- [EMAIL PROTECTED] For additional commands: mailto:[EMAIL PROTECTED] Troubles with the list: mailto:[EMAIL PROTECTED] -- To unsubscribe: mailto:[EMAIL PROTECTED] For additional commands: mailto:[EMAIL PROTECTED] Troubles with the list: mailto:[EMAIL PROTECTED] -- To unsubscribe: mailto:[EMAIL PROTECTED] For additional commands: mailto:[EMAIL PROTECTED] Troubles with the list: mailto:[EMAIL PROTECTED]
Re: Tomcat and Unicode parameters in URLs ???
Setting the content type, as you did above, only affects the *output* of that particular response -- it has nothing to do with how the next *input* request from that browser will be handled. In order to deal with request parameters in an incoming request, you must tell Tomcat what encoding to use, *before* processing the parameters. This is done by calling the request.setCharacterEncoding() method that was added in Servlet 2.3. As long as you call this before calling methods like request.getParameter(), the proper encoding will be applied. One way to do this without modifying your application itself is to use a Filter that looks at incoming requests and decides what encoding should be used -- perhaps by looking at the codeAccept-Language/code header, or based on attributes you have stored in the current session that indicate what the user will be supplying. But what happens if you really do not know what character set to expect ? In our company, the webserver is used for B2B messaging with customers and not purely serving web pages. For example, we can accept a message with a query string like this http://vpn.ourcompany.com/servlet/incoming?company=CustomerNamereferenceId=1234noteText= The noteText could be in one of several languages since we do international business. We're currently considering adding a language parameter such as Language=English but it would be nicer to autodetect the language. Is this possible ? Thank you, Soefara _ Join the worlds largest e-mail service with MSN Hotmail. http://www.hotmail.com -- To unsubscribe: mailto:[EMAIL PROTECTED] For additional commands: mailto:[EMAIL PROTECTED] Troubles with the list: mailto:[EMAIL PROTECTED]
Re: Tomcat and Unicode parameters in URLs ???
On Tue, 19 Mar 2002, Soefara Redzuan wrote: Date: Tue, 19 Mar 2002 09:20:47 +0800 From: Soefara Redzuan [EMAIL PROTECTED] Reply-To: Tomcat Users List [EMAIL PROTECTED] To: [EMAIL PROTECTED] Subject: Re: Tomcat and Unicode parameters in URLs ??? Setting the content type, as you did above, only affects the *output* of that particular response -- it has nothing to do with how the next *input* request from that browser will be handled. In order to deal with request parameters in an incoming request, you must tell Tomcat what encoding to use, *before* processing the parameters. This is done by calling the request.setCharacterEncoding() method that was added in Servlet 2.3. As long as you call this before calling methods like request.getParameter(), the proper encoding will be applied. One way to do this without modifying your application itself is to use a Filter that looks at incoming requests and decides what encoding should be used -- perhaps by looking at the codeAccept-Language/code header, or based on attributes you have stored in the current session that indicate what the user will be supplying. But what happens if you really do not know what character set to expect ? In our company, the webserver is used for B2B messaging with customers and not purely serving web pages. For example, we can accept a message with a query string like this http://vpn.ourcompany.com/servlet/incoming?company=CustomerNamereferenceId=1234noteText= The noteText could be in one of several languages since we do international business. We're currently considering adding a language parameter such as Language=English but it would be nicer to autodetect the language. Is this possible ? It would be possible if the HTTP specs defined a way to tell the server what language the HTTP URL is encoded in, and if browsers actually sent along that indication. Neither seems to be the case in general -- even on a POST transaction (where the browsers really have no excuse for not including the character encoding in the Content-Type header), many don't. Thus, you're stuck haveing to figure it out for yourself. Note that adding a language parameter to the query string isn't going to do you much good -- you have to call setCharacterEncoding() *before* you call request.getParameter(), so you won't have been able to read the language field first. Thank you, Soefara _ Craig Join the worlds largest e-mail service with MSN Hotmail. http://www.hotmail.com -- To unsubscribe: mailto:[EMAIL PROTECTED] For additional commands: mailto:[EMAIL PROTECTED] Troubles with the list: mailto:[EMAIL PROTECTED] -- To unsubscribe: mailto:[EMAIL PROTECTED] For additional commands: mailto:[EMAIL PROTECTED] Troubles with the list: mailto:[EMAIL PROTECTED]
Tomcat and Unicode parameters in URLs ???
Hello all, I tried a million ways of making Tomcat 4.0.3 work with Unicode URL parameters, but nothing seems to work. It always corrupts the parameters. Does anybody know a workaround to make Unicode request parameters work with Tomcat? For instance, I changed the SnoopServlet example given with Tomcat 4 to output the response in the unicode with setContentType(text/html;charset=utf-8). But when I write unicode parameters in the URL text area of Internet Explorer as parameters to SnoopServlet, it always corrupts my parameters. Instead of printing them a two-bye unicode characters, it prints every unicode character as two one-byte garbage or otherwise ASCII characters. I also tried making a URL request using the URL class in JAVA SDK 1.4. That didn't work as well. The URLEncode and URLDecode classes in the SDK don't seem to do their job right also. Has anyone been able to make use of these classes? Any workarounds and bug reports will be greatly appreciated. Thanks, Mete __ Do You Yahoo!? Yahoo! Sports - live college hoops coverage http://sports.yahoo.com/ -- To unsubscribe: mailto:[EMAIL PROTECTED] For additional commands: mailto:[EMAIL PROTECTED] Troubles with the list: mailto:[EMAIL PROTECTED]
Re: Tomcat and Unicode parameters in URLs ???
On Sat, 16 Mar 2002, Mete Kural wrote: Date: Sat, 16 Mar 2002 11:05:08 -0800 (PST) From: Mete Kural [EMAIL PROTECTED] Reply-To: Tomcat Users List [EMAIL PROTECTED] To: [EMAIL PROTECTED] Subject: Tomcat and Unicode parameters in URLs ??? Hello all, I tried a million ways of making Tomcat 4.0.3 work with Unicode URL parameters, but nothing seems to work. It always corrupts the parameters. Does anybody know a workaround to make Unicode request parameters work with Tomcat? For instance, I changed the SnoopServlet example given with Tomcat 4 to output the response in the unicode with setContentType(text/html;charset=utf-8). But when I write unicode parameters in the URL text area of Internet Explorer as parameters to SnoopServlet, it always corrupts my parameters. Instead of printing them a two-bye unicode characters, it prints every unicode character as two one-byte garbage or otherwise ASCII characters. I also tried making a URL request using the URL class in JAVA SDK 1.4. That didn't work as well. The URLEncode and URLDecode classes in the SDK don't seem to do their job right also. Has anyone been able to make use of these classes? Any workarounds and bug reports will be greatly appreciated. Setting the content type, as you did above, only affects the *output* of that particular response -- it has nothing to do with how the next *input* request from that browser will be handled. In order to deal with request parameters in an incoming request, you must tell Tomcat what encoding to use, *before* processing the parameters. This is done by calling the request.setCharacterEncoding() method that was added in Servlet 2.3. As long as you call this before calling methods like request.getParameter(), the proper encoding will be applied. One way to do this without modifying your application itself is to use a Filter that looks at incoming requests and decides what encoding should be used -- perhaps by looking at the codeAccept-Language/code header, or based on attributes you have stored in the current session that indicate what the user will be supplying. A very simple example of such a filter is included in the /examples webapp shipped with Tomcat 4 -- the source code for this filter is in file SetCharacterEncodingFilter.java in the $CATALINA_HOME/webapps/examples/WEB-INF/classes/filters subdirectory. This example is fairly simpleminded -- you just configure a filter initialization parameter that is used to set the encoding for all requests -- but you can use it as a starting point for more sophisticated processing by subclassing it and overriding the selectEncoding() method. This filter can be enabled by copying the appropriate class file to your own WEB-INF/classes directory, and adding a filter definition to your web.xml file: filter filter-nameCharacter Encoding Filter/filter-name filter-classfilters.SetCharacterEncodingFilter/filter-class init-param param-nameencoding/param-name param-valueUTF-8/param-value /init-param /filter Then, you select which requests this filter applies to with a filter mapping -- the /* pattern says apply it to *all* requests: filter-mapping filter-nameCharacter Encoding Filter/filter-name url-pattern/*/url-pattern /filter-mapping With filter mappings like this, you can be more selective about which URLs it applies to by using a more precise URL pattern, or apply different filters to different URLs -- all without affecting your servlets or JSP apges at all. The syntax for the url-pattern element in a filter mapping is the same as that used for a servlet mapping. Be sure to put these elements in the correct places in your web.xml file to maintain the element order that is required by the DTD. Thanks, Mete Craig -- To unsubscribe: mailto:[EMAIL PROTECTED] For additional commands: mailto:[EMAIL PROTECTED] Troubles with the list: mailto:[EMAIL PROTECTED]
Problem with request parameter in UTF-8 (Unicode)
I have a JSP page including a form, all encoded in UTF-8, which reaches the requesting browser just fine. The browser then submits the form (GET or POST, same problem) to another JSP page on the same server. When I try to read the request parameters via request.getParameter("somename"), I receive garbage for every character in the form fields not in the standard ASCII charset. The request.getCharacterEncoding() function returns null. I seems to me the received parameters are converted from ISO 8859-1 to UTF-8 by Tomcat, though they already are encoded in UTF-8. Am I missing a configuration setting, like some sort of default character encoding? I have looked through loads of docs and the config files themselves, but I did not find anything (except for the "file.encoding=UTF_8" which I needed for sending the unicode pages). I would appreciate any help. TIA, Frank Peters
UNICODE
Hello, can sombody tell me, how can I configure Tomcat not to convert UTF-8 to ISO-8859-1. If I transform my XML documents with org.apache.xalan.xslt.Process from the command line, the result html fil is OK. If I open the document locally in Netscape or IE with encoding UTF-8 I can see all the characters correctly. But if I do the same conversion with cocoon on the server side I can see only ???. Is it only a configuration fault? Can somebody tell me, how to get the right characters? Thanks Krisztian Nemeth Uni Koblenz Germany - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, email: [EMAIL PROTECTED]
Unicode translation?
I have an interesting problem. First, here's the environment: Linux 2.2 (Redhat 7) Apache 1.4 (not involved in this example) Tomcat 3.2.1 Macromedia Ultradev 4 for development MySQL 3.30 Mm.mysql driver for JDBC I can create a database connection in Ultradev, and test it, and it returns proper values. I am selecting a date, a username, and some text. In the test, the values are fine. When I "go live" and connect to the server (http:://hostname:8080/something.jsp - bypassing Apache), then the page displays the date properly, but the username and text are horribly screwed up. Here's what it looks like: Date/TimeUserActivity 2001-01-10 10:12:20.0[B@8b1e6[B@578dfb 2001-01-10 10:12:20.0[B@2a987d[B@13bc1 2001-01-10 10:12:21.0[B@7a36a2[B@18c6f3 2001-01-10 10:12:21.0[B@2d8ecd[B@7a5e5e 2001-01-10 10:12:21.0[B@497062[B@716fa0 2001-01-10 10:12:21.0[B@57807a[B@33cac9 2001-01-10 10:12:21.0[B@467248[B@78dc08 2001-01-10 10:12:21.0[B@35c22f[B@5fd90f 2001-01-10 10:12:21.0[B@238785[B@1646fd 2001-01-10 10:12:21.0[B@ebe18[B@62433b 2001-01-10 10:12:21.0[B@2be654[B@1ea173 2001-01-10 10:12:21.0[B@79a49f[B@270107 It could be that the driver is doing something wrong (but why did it work during the test?), but it appears more likely that tomcat is doing something to the data: perhaps expecting Unicode? Any suggestions are appreciated. -- Glen Campbell [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, email: [EMAIL PROTECTED]