Re: Download of text file, charset problem on Mac
Re: Download of text file, charset problem on Mac
- Subject: Re: Download of text file, charset problem on Mac
- From: Hugi Thordarson <email@hidden>
- Date: Wed, 27 Apr 2005 19:58:07 +0000
Hello Jon!
Your code for converting the string looks correct. Is it possiple that
this is not working because you have the wrong capitalization in the
name of the "user-agent" header? In all the WO adaptors I know, the
user-agent header's name is written in all lowercase, "user-agent"
rather than "User-Agent".
Cheers,
Hugi
// Hugi Thordarson
// Atvinnulaus
// http://www.karlmenn.is/
On 27.4.2005, at 13:47, Jon Kleiser wrote:
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
_______________________________________________
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