Tue, 19 Oct 2010 22:23:45 -0700 (PDT), /Javas/:
My java program is writing contents to a excel file and naming it with
scandic characters(äÄöÖåÅ). When the file is exported to a Windows
machine I am able to view and download the same from my jsp. But when
the file is exported to a Linux machine I am unable to view and
download the same file. Is it something related with the encoding?
Could you guys help me to resolve it?
Eg:- of a file name - "Kyä_1998_SB15.xls"
What response headers do you serve from your web application when
downloading the file? Are you supplying the file name as 'filename'
parameter to a 'Content-Disposition' header? Do you encode the name
according to RFC 2047 "Message Header Extensions
for Non-ASCII Text" <
http://tools.ietf.org/html/rfc2047>? How are
you unable to view and download - what specific error does your
browser give you when you try to download? What do you mean by
"exported" - does you application create a file on disk which is
then served (and probably the web application fails to find the file
to serve)?
If your problem is related to last question here's something to be
aware of. I can't verify it currently, but previously I've hit such
problem on Unices. On Windows with NTFS file names are stored and
file APIs are fed using Unicode characters, but on Unices the file
names have no specific encoding and it is up to the application to
decode them appropriately. While UTF-8 is used by most of the *nix
software to decode file names today, the JVM uses the default system
encoding to convert file names (as in Java file names are already
given as decoded strings). If the default system encoding (used by
the JVM) is not UTF-8 you can run into all kind of troubles saving
and then trying to locate a file under certain name containing
non-ASCII characters. You may try to set some or all of these:
LANG=en_US.UTF-8
LC_CTYPE=UTF-8
LC_ALL=en_US.UTF-8
Unfortunately I don't have much personal experience with Unices and
I'm not sure the given environment settings are 100% correct. You
may wish to search further on the subject.