java.net.URLEncoder.encode
-----Original Message-----
From: Nigel Blake [mailto:[EMAIL PROTECTED]
Sent: Monday, April 03, 2006 5:43 PM
To: [email protected]
Subject: Character Encoding : Unix vs Windows
Problem : Creating a URL type with parameters that have a space between
them causes an IOException in a javabean when called from Tomcat
5.0.0.27 on a Unix installation. Using the same bean and JSP code causes
no problem when invoked on the same version of Tomcat on a Windows
installation.
Solutions tried :
1.Ensured that the server connector encoding is UTF-8 (suggested in the
FAQ) 2. Have ensured that jsp the page instruction is UTF-8 3. I could
turn the bean into a servlet and try using the setContentType or
SetCharacterEncoding. ( I would rather not )
Any suggestions that would make Unix implementation work would be
gratefully received. I have run out of ideas...
Thanks Nigel
Example code :
====================================
URL birdSite = new
URL("http://orientalbirdimages.org/search.php?keyword=black bittern");
try {
webPageStream = new BufferedReader(new InputStreamReader(birdSite.
openStream()));
}
catch (MalformedURLException ne) {
System.out.println(
"Malformed URL Error called from within getPageNumber()" +
ne.toString());
}
catch (IOException ie) {
System.out.println("IOException called from within getPageNumber"
+ ie.toString());
}
========================================================
The IOException is caught under unix when the variable I pass to the URL
query string has a query parameter of more than more than 1 word as in
'black bittern' above.
---------------------------------------------------------------------
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]