Re: "Cue Sheet Parser" - Use NSString?
Re: "Cue Sheet Parser" - Use NSString?
- Subject: Re: "Cue Sheet Parser" - Use NSString?
- From: Benjamin Frere <email@hidden>
- Date: Wed, 21 Nov 2007 00:47:05 +0100
Thanks!
Hopefully, there are real text files. Here's an example:
PERFORMER "Keith Jarrett"
TITLE "The Köln Concert"
FILE "Keith Jarrett - The Köln Concert.flac" WAVE
TRACK 01 AUDIO
TITLE "Köln, January 24, 1975 Part I"
INDEX 00 00:00:00
INDEX 01 00:00:33
TRACK 02 AUDIO
TITLE "Köln, January 24, 1975 Part II a"
ISRC 0P4000700260
INDEX 01 26:02:03
TRACK 03 AUDIO
TITLE "Köln, January 24, 1975 Part II b"
INDEX 01 40:56:58
TRACK 04 AUDIO
TITLE "Köln, January 24, 1975 Part II c"
INDEX 01 59:11:20
For the encoding, it's 99% of the time in Windows Latin-1, as they
comes from the Windows World.
But I would provide to the user a preference in the encoding (for the
reading).
I didn't know about the NSScanner class ! Thanks a lot about it. I
suppose that will make my life easier :)
Benjamin
------------------------
Benjamin Frere
www.iabloko.com
------------------------
On 21 Nov 2007, at 00:32, Uli Kusterer wrote:
Am 20.11.2007 um 22:45 schrieb Benjamin Frere:
- (id)initWithContentsOfFile:(NSString *)path encoding:
(NSStringEncoding)enc error:(NSError **)error
?
Cue Sheet are very shor text file, and I just need to read it to
parse it.
If they really are *text*, then yes. We've had some people here a
while ago trying to use NSString to read binary files, and they
weren't happy...
Just make sure you choose the right encoding. In 99% of the cases,
ASCII is the wrong encoding, because there is no such thing as Mac-
ASCII or Windows-ASCII... You may also want to have a look at the
NSScanner class, which is kinda helpful for parsing text of all kinds.
Cheers,
-- M. Uli Kusterer
"The Witnesses of TeachText are everywhere..."
http://www.zathras.de
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden