Downloading files with scandic charcaters - java

J

Javas

Hi,

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"

Thanks!
 
R

RedGrittyBrick

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?
Probably.


Could you guys help me to resolve it?

Maybe, if you posted an SSCCE (http://www.sscce.org/)
 
R

Roedy Green

Is it something related with the encoding?

See http://mindprod.com/jgloss/encoding.html

If I were in your position, I would convert the file to UTF-8 or GZip
compressed DataOutputStream, that way you avoid the need for support
for national character sets.


For sample code to read and write the files, see
http://mindprod.com/applet/fileio.html
--
Roedy Green Canadian Mind Products
http://mindprod.com

Microsoft has a new version out, Windows XP, which according to everybody is the "most reliable Windows ever." To me, this is like saying that asparagus is "the most articulate vegetable ever."
~ Dave Barry
 
S

Stanimir Stamenkov

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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,582
Members
45,070
Latest member
BiogenixGummies

Latest Threads

Top