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: Chuck Hill <email@hidden>
- Date: Wed, 27 Apr 2005 11:09:28 -0700
My first though is that there may not be a MacRoman encoding available
on Solaris. Is it throwing an exception
(UnsupportedEncodingException)? Have you tried using UTF-8 instead of
MacRoman?
Chuck
On Apr 27, 2005, at 6:47 AM, 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:
village.net
This email sent to email@hidden
--
Practical WebObjects - a book for intermediate WebObjects developers
who want to increase their overall knowledge of WebObjects, or those
who are trying to solve specific application development problems.
http://www.global-village.net/products/practical_webobjects
_______________________________________________
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