Welcome to the MacNN Forums.

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

You are here: MacNN Forums > Software - Troubleshooting and Discussion > Developer Center > \r in a plist?

\r in a plist?
Thread Tools
Addicted to MacNN
Join Date: Nov 2002
Location: Seattle, WA
Status: Offline
Reply With Quote
Oct 11, 2003, 02:10 AM
 
I'm trying to screen scrape from blockbuster.com, where it shows chapter times from dvds. Each line of chapters ends in a \r except the last one, which ends in \n (wtf, btw, and how would you even create such a file, with different newline chars used?), and I'd like to store this "ending" value in a plist, so if blockbuster changes it (fixes it?), the program can adapt without recompiling.

So how to put this character in a plist file? well I tried saving the downloaded string as a file, opening in BBEdit, copying the newline, pasting into the plist and saving. But when I pulled up my NSDictionary, the value I got was \n, not \r. I also tried putting <string>\r</string> as a value in the plist, but that gave me \\r.

so, is there any way to store a \r in a plist? or do I have to "post-process" the data I get from my plist (which works, but is quite lame)?
     
Fresh-Faced Recruit
Join Date: May 2003
Status: Offline
Reply With Quote
Oct 12, 2003, 03:13 PM
 
why not use the ascii value?
I am now going to tell the computer what he can do with a life-times supply of chocolate.
     
Addicted to MacNN
Join Date: Nov 2002
Location: Seattle, WA
Status: Offline
Reply With Quote
Oct 12, 2003, 04:30 PM
 
huh. didn't think of that. anyone know what it is?

edit: how do you put the ascii value in the plist? whouldn't it need to be preceeded by a \, which would be escaped by NSArray when I read it back in (just like the \r was)?
     
Fresh-Faced Recruit
Join Date: May 2003
Status: Offline
Reply With Quote
Oct 14, 2003, 11:45 PM
 
I believe it is 13 Dec (you can check all of them at asciitable.com). you can just put the ascii value into the string using format and set the char equal to the int value.

Code:
string = [NSString stringWithFormat: @"%d", c]; c = [string intValue];
I am now going to tell the computer what he can do with a life-times supply of chocolate.
     
Addicted to MacNN
Join Date: Nov 2002
Location: Seattle, WA
Status: Offline
Reply With Quote
Oct 15, 2003, 02:10 PM
 
so there's no way to actually put it in the plist? I would have to read all strings that are @"\013" as @"\r" and do extra processing of the Dictionary I get from my plist? Since posting I've found a way to avoid the whole issue in this particular case, but I still think there should be a way to store the standard ascii characters in a plist.
     
   
Thread Tools
Forum Links
Forum Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Top
Privacy Policy
All times are GMT -5. The time now is 07:15 PM.
All contents of these forums © 1995-2011 MacNN. All rights reserved.
Branding + Design: www.gesamtbild.com
vBulletin v.3.8.7 © 2000-2011, Jelsoft Enterprises Ltd., Content Relevant URLs by vBSEO 3.3.2