Skip navigation.
 
mlHow would you convert a \r to its UTF-8 counterpart ?
FROM : Stéphane Sudre
DATE : Tue Jul 25 23:20:19 2006

Let's say I want to save the following string in a .plist file:

"this is a stupid line of text, isn't it?\r"

and the resulting .plist shall be something like this:

<I don't remember the plist header so this is a replacement>
<dict>
   <key>A string</key>
   <string> this is a stupid line of text, isn't it?&#x0D;</string>
</dict>
</I should remember them though>

The idea being to have the \r character be replaced by its hexa value.

If I save a NSDictionary using the writeToFile:atomically: API, I will
get a '\r'.

If I replace the \r with &#x0D;, I will get &amp;#x0D; of course.

Any idea on how to do this?

Related mailsAuthorDate
mlHow would you convert a \r to its UTF-8 counterpart ? Stéphane Sudre Jul 25, 23:20
mlRe: How would you convert a \r to its UTF-8 counterpart ? Ricky Sharp Jul 25, 23:39
mlRe: How would you convert a \r to its UTF-8 counterpart ? Shawn Erickson Jul 26, 00:03
mlRe: How would you convert a \r to its UTF-8 counterpart ? Stéphane Sudre Jul 26, 21:38
mlRe: How would you convert a \r to its UTF-8 counterpart ? stephen joseph but… Jul 26, 22:11
mlRe: How would you convert a \r to its UTF-8 counterpart ? Nir Soffer Jul 26, 23:22
mlRe: How would you convert a \r to its UTF-8 counterpart ? Matt Neuburg Jul 27, 03:21
mlRe: How would you convert a \r to its UTF-8 counterpart ? Stéphane Sudre Jul 28, 20:23
mlRe: How would you convert a \r to its UTF-8 counterpart ? stephen joseph but… Jul 28, 23:57
mlRe: How would you convert a \r to its UTF-8 counterpart ? John Stiles Jul 29, 00:03
mlRe: How would you convert a \r to its UTF-8 counterpart ? Michael Nickerson Jul 29, 01:32
mlRe: How would you convert a \r to its UTF-8 counterpart ? stephen joseph but… Jul 29, 06:29