Re: am i loading this pdf data correctly or not?
Re: am i loading this pdf data correctly or not?
- Subject: Re: am i loading this pdf data correctly or not?
- From: Marcel Weiher <email@hidden>
- Date: Thu, 7 Aug 2003 15:14:18 +0100
say i just wanted to use regex, for example, to count the number of
occurrences of the three characters 'obj' in some data (that just
*happens* to be from a pdf data file). pdf semantics are neither here
nor there. when doing this count the regex correctly counts the
occurrence of the pattern i'm searching for up to a certain point. it
stops, due to i think, a particular block of data that's in the
NSString. the particular part of the NSString that makes the regex
stops looks like ... \\001\\u03a98Vv\\u25ca^{\\371\\u220f\\2... so
this would be a problem of my lack of understanding of NSStrings
because i'd expect those character not to cause a problem to NSString
nor a regex. in fact it doesn't seem to cause NSString a problem, only
the regex.
the fine tuned to-the-point question is this. forget pdfs. why does
data in an NSString that looks like this :
... \\001\\u03a98Vv\\u25ca^{\\371\\u220f\\2...
not break an NSString (not break as in when i NSLog output it the
whole thing outputs - from start to finish), but break a regex parse
(break as in it stops prematurely)?
I have no idea, but there can be all sorts of reasons. However, I know
that loading certain binary files into current versions of TextEdit (or
any other Cocoa text view) will exhibit the same behavior. I also know
that to get just raw bytes with only raw-byte semantics (which you
need), you have to use NSData. I also know that regexing isn't
actually going to reliably get you data out of a PDF file.
The question for me is wether you want to know why exactly something
that isn't actually guaranteed to work is failing, or wether you want
to get something to work.
Marcel
--
Marcel Weiher Metaobject Software Technologies
email@hidden www.metaobject.com
Metaprogramming for the Graphic Arts. HOM, IDEAs, MetaAd etc.
1d480c25f397c4786386135f8e8938e4
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.