• 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
Re: Saving UTF-8 as File
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Saving UTF-8 as File


  • Subject: Re: Saving UTF-8 as File
  • From: John Stiles <email@hidden>
  • Date: Tue, 19 Apr 2005 11:44:34 -0700


On Apr 19, 2005, at 11:26 AM, Jim Hamilton wrote:

Can someone point me in the right direction to be able to save the HTML string as a UTF-8 encoded file?

1) Do you start the file with a BOM? (Check unicode.org to be sure, but I think it's 0xEF 0xBB 0xBF.)


2) Does your HTML have an encoding tag? ("charset=utf-8" in a meta tag)

I don't know if #1 is relevant--HTML doesn't require a BOM, nor does it cause any problems if one exists.
#2, OTOH, is critical. If you aren't specifying UTF8 encoding, you will not get the right results.
I agree with some other posters in the thread--use [myString UTF8String] and output that. It seems as if the NSString writeToFile method does not give you enough control over encodings.


_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden


  • Follow-Ups:
    • Re: Saving UTF-8 as File
      • From: August Trometer <email@hidden>
References: 
 >Saving UTF-8 as File (From: August Trometer <email@hidden>)
 >Re: Saving UTF-8 as File (From: Jim Hamilton <email@hidden>)

  • Prev by Date: Re: NSScrollView
  • Next by Date: Re: upper limit on retain count
  • Previous by thread: Re: Saving UTF-8 as File
  • Next by thread: Re: Saving UTF-8 as File
  • Index(es):
    • Date
    • Thread