FROM : John Stiles
DATE : Tue Apr 19 20:44:34 2005
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.
DATE : Tue Apr 19 20:44:34 2005
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.
| Related mails | Author | Date |
|---|---|---|
| August Trometer | Apr 19, 19:53 | |
| Ondra Cada | Apr 19, 20:23 | |
| Jim Hamilton | Apr 19, 20:26 | |
| Douglas Davidson | Apr 19, 20:26 | |
| Shawn Erickson | Apr 19, 20:30 | |
| Tim Gogolin | Apr 19, 20:31 | |
| Shawn Erickson | Apr 19, 20:35 | |
| Sherm Pendley | Apr 19, 20:39 | |
| John Stiles | Apr 19, 20:44 | |
| August Trometer | Apr 19, 20:57 | |
| Ondra Cada | Apr 19, 21:18 |






Cocoa mail archive

