File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Tomcat and the fly likes File encoding configuration in Tomcat Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login


Win a copy of The Mikado Method this week in the Agile and other Processes forum!
JavaRanch » Java Forums » Products » Tomcat
Reply Bookmark "File encoding configuration in Tomcat" Watch "File encoding configuration in Tomcat" New topic
Author

File encoding configuration in Tomcat

david chen
Ranch Hand

Joined: Nov 30, 2001
Posts: 44
Hi,
I am having problems in reading the copyright character in Tomcat. Aside from passing -Dfile.encoding=ISO-8859-1, is there any place in Tomcat I can set how my application will read/write a text file? I'm currently having weird problem. Please refer to Character Encoding and Copyright Character to see detailed explanation of the problem.
Here's my environment configuration. I have also indicated the system properties:
1. My PC (works fine here)
- file.encoding=ISO-8859-1
- os.name=Windows XP
- os.version=5.1
2. Company's Development Box (works fine here)
- file.encoding=ISO-8859-1
- os.name=Linux
- os.version=2.4.9-e.35
3. QA Box (doesn't work)
- file.encoding=ISO-8859-1
- os.name=Linux
- os.version=2.4.9-e.38smp
Please help.
Thank you very much.
Regards,
David
Mike Curwen
Ranch Hand

Joined: Feb 20, 2001
Posts: 3695

Are the versions of Tomcat between those 3 environments the same?
You're using the same browser on the same machine to access all 3?


Have you tried explicitly setting the following:
<%@ page pageEncoding="ISO-8859-1" %>
<%@ page contentType="text/html;charset=ISO-8859-1" %>

(those are the defaults)

There is also a setting in $CATALINA_HOME/conf/web.xml
The *.JSP servlet is configured by default to use UTF-8 in its generated source files. Control it with the 'javaEncoding' parameter.
david chen
Ranch Hand

Joined: Nov 30, 2001
Posts: 44
Hi Mike,
All three environments use Tomcat v3.3.1a. There's no conf/web.xml file in our Tomcat folder, I guess this file only exist for version 4x upward. And I'm using the browser on my PC to access webpages from 3 environments.
I have the following code that reads the text file:

And my JSP contains the following code:

Thank you very much.
- David
[ April 08, 2004: Message edited by: david chen ]
 
I agree. Here's the link: http://ej-technologies/jprofiler - if it wasn't for jprofiler, we would need to run our stuff on 16 servers instead of 3.
 
subject: File encoding configuration in Tomcat
 
Similar Threads
Few Doubts about encoding
character corruption in french and german languages
Need help. Special Characters(�) retrieval from the database using JDBC
File Encoding - copyright character read/displayed as "?"
Character Encoding and Copyright Character