Download of text file, charset problem on Mac
Download of text file, charset problem on Mac
- Subject: Download of text file, charset problem on Mac
- From: Jon Kleiser <email@hidden>
- Date: Wed, 27 Apr 2005 15:47:25 +0200
I have a WO application where the user may generate and download a
text file. (This now works quite fine, thanks to Chuck Hill's reply
to my previous mail.) The probkem now is to get the right character
set in these files, when downloaded by a Mac OS X client. (The
Norwegian alphabet has six characters æøåÆØÅ that always represent a
problem.) The code I use to detect and convert now looks like the
lines below, but the result (when viewed by TextEdit, or BBEdit 7) is
not what it should be.
public static String convertStringForRequest(String s, WORequest request) {
String userAgent = request.headerForKey("User-Agent");
if ((userAgent != null) && (userAgent.indexOf("Mac") >= 0)) {
try {
return new String(s.getBytes(), "MacRoman");
} catch (Exception e) {
...
}
}
return s;
}
When I run the application on my developer Mac, and download to the
same, this method's input and output strings are equal. When I run
the application on our Solaris box, and download to my Mac, the input
and output strings are different. In both cases, the resulting
character set is wrong.
Most of the text in the generated text file is coming straight from
an Oracle database. We have no problems with the Norwegian characters
in the web pages.
I'll appreciate any ideas on how to handle this charset stuff.
Jon Kleiser
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden