PDA

View Full Version : Default encoding [internationalization]


luciano
09-17-2004, 11:52 AM
Hi,

I'm moving my site to Rimu and I have a problem with file encoding. Java classes like java.io.FileReader and java.io.FileWriter use the ASCII encoding while I'm expecting iso-8859-1. I've set -Dfile.encoding=ISO-8859-1 but nothing has changed. I've also set LANG to en_US, en_US.iso8859-1, en_US.iso-8859-1, en_US.iso885915 and other variants (and restarted Tomcat every time).

On my previous (shared) hosting, LANG and -Dfile.encoding were not set, but I got iso-8859-1 in al FileReaders/Writers. I know I can use InputStreamReader and OutputStreamWriter, but this doesn't solve the problem with third-party libraries and tools (in my case SiteMesh).

Any suggestion? I tried on comp.lang.java.programmer (no answer) and I'm going to ask SiteMesk people.

guillaume
10-12-2004, 12:32 PM
Hope this answser does not come too late..
You need to define the language supported in /etc/sysconfig/i18n

luciano
10-26-2004, 11:04 AM
No, it didn't come too late. And it works! Thank you for your suggestion.

guillaume
11-09-2004, 07:15 AM
If you are using also emacs, here are some commands to add to your emacs profile for default encoding...

(set-terminal-coding-system 'latin-1)
(set-keyboard-coding-system 'latin-1)
(set-language-environment 'latin-1)

guillaume
02-02-2005, 03:31 PM
Hi,
to complete this internationalization configuration, think to add to /etc/profile the following line (change language and zone)
export TZ="Europe/Paris"
export LC_ALL=fr_FR

sicozu
07-07-2006, 10:30 AM
Hi everybody,

I was experimenting the same encoding problems... I have hosted a tomcat webapp that relies on XML and XSL files in order to render pages in english, french and spanish.

Well everything worked fine on my mac, but when I uploaded the webapp to rimushosting servers, all spanish and french characters were messed up.

I followed the instructions I read in this thread, but the problem persisted and I was about to get paranoic, when suddenly I realized that all my xml and xsl files where saved in ISO-8859-1. The HTML pages had a ISO-8859-1 charset too in the <head> element....

So I changed every occurence of ISO-8859-1 in my files by UTF-8 (I configured my preferred editor to save files in UTF-8 too ), redeployed, and magically everything was fixed!

I don't if this can help someone, at least it worked for me....
pedro