• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
[OT] file encoding
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[OT] file encoding


  • Subject: [OT] file encoding
  • From: Ute Hoffmann <email@hidden>
  • Date: Tue, 15 May 2007 14:23:58 +0200

Hallo,
I need to save a string (text) into a file. The file has to have a specified encoding which differs from the default encoding which is MacRoman.

How can I archive this (probably very easy, but...)

I can create and save the file. But it always ends in a macRoman/MacCentralEurope encoding (no matter what I try)

This is trhe relevant part of my code:

A. Convert String from MacRoman to UTF 8:
try{
String fileInhalt = new String(inhaltsstring.getBytes("MacRoman"), "UTF8");
writeOutput(fileInhalt);
}
catch (Exception e){
NSLog.out.appendln("String Konversion hat nicht geklappt"+e.toString());
}

Works on my string. no error message.

B. Save file in file systhem

public void writeOutput(String str) {

try {
FileOutputStream fos = new FileOutputStream(pfade.zumRootVerzeichnis()+pfade.ordnerPfad()+"/rss/rss.xml");
Writer out = new OutputStreamWriter(fos, "UTF8");
out.write(str);
out.close();
} catch (IOException e) {
e.printStackTrace();
}
}

The file is saved, but it seems it is not UTF-8 but still MacRoman :-(. When I open it with hydra it says still Mac encoded, not UTF-8...

Any pointers welcome!

Regards

Ute
 _______________________________________________
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

  • Follow-Ups:
    • Re: [OT] file encoding
      • From: Rudi Angela <email@hidden>
    • Re: [OT] file encoding
      • From: Alexander Spohr <email@hidden>
    • Re: [OT] file encoding
      • From: Chuck Hill <email@hidden>
  • Prev by Date: Re: EOGenerator and prototypes
  • Next by Date: mod_WebObjects with 64Bit Linux RPM?
  • Previous by thread: Re: EOGenerator and prototypes
  • Next by thread: Re: [OT] file encoding
  • Index(es):
    • Date
    • Thread