FROM : Jens Alfke
DATE : Wed Mar 19 19:34:25 2008
On 19 Mar '08, at 10:04 AM, J. Todd Slack wrote:
> How do I write an ASCII 254 and ASCII 255 at the beginning of the
> NSString
> that I am putting in the file I want to be read back in at a later
> date? '
Those wouldn't go into the NSString; they're the byte-order-mark that
prefixes the UTF-16 data, not part of the character data itself.
I really recommend you write out the string in UTF-8 instead, as I
suggested yesterday (with example code). UTF-8 is the most common
modern encoding for text, because (a) it's a superset of ascii, and
(b) for Roman alphabets it's up to twice as compact as UTF-16.
—Jens
DATE : Wed Mar 19 19:34:25 2008
On 19 Mar '08, at 10:04 AM, J. Todd Slack wrote:
> How do I write an ASCII 254 and ASCII 255 at the beginning of the
> NSString
> that I am putting in the file I want to be read back in at a later
> date? '
Those wouldn't go into the NSString; they're the byte-order-mark that
prefixes the UTF-16 data, not part of the character data itself.
I really recommend you write out the string in UTF-8 instead, as I
suggested yesterday (with example code). UTF-8 is the most common
modern encoding for text, because (a) it's a superset of ascii, and
(b) for Roman alphabets it's up to twice as compact as UTF-16.
—Jens
| Related mails | Author | Date |
|---|---|---|
| J. Todd Slack | Mar 19, 05:34 | |
| stephen joseph but… | Mar 19, 05:41 | |
| Andrew Merenbach | Mar 19, 05:45 | |
| J. Todd Slack | Mar 19, 05:53 | |
| stephen joseph but… | Mar 19, 05:57 | |
| Jens Alfke | Mar 19, 06:47 | |
| J. Todd Slack | Mar 19, 18:04 | |
| stephen joseph but… | Mar 19, 18:11 | |
| Jens Alfke | Mar 19, 19:34 | |
| Deborah Goldsmith | Mar 25, 01:59 |






Cocoa mail archive

