On May 18, 2006, at 8:29 AM, brian d foy wrote:
* Will a plist always be utf8? For instance, what about
localizations for Japan, etc? The encoding shows up in the <?xml ...?>
portion, but am I going to have to open the file to find that, then
re-open it?
I guess it is really up to the file - the first line (is it always
the first?) declares it:
<?xml version="1.0" encoding="UTF-8"?>
Maybe you could grab the first line, parse, and then slurp the rest
accordingly?
* Actually hook into the Mac libraries and let the OS parse it and
give me back the data. That's the best solution, but only if I give up
being pure-Perl and portable, which are both very important to me. I
will gladly add something to do that if someone writes it for me, but
alongside the pure Perl version.
* Can I hook into the Mac stuff with something like Inline::Java?
Actually, you can do this without resorting to Java - there was a
great article on using the Objective-C bridge (Foundation.pm) at:
http://www.macdevcenter.com/pub/a/mac/2005/07/29/plist.html
I had a quick hack based on this to create Mac::Tie::Plist:
http://search.cpan.org/~gbrock/Mac-Tie-PList-0.01/lib/Mac/Tie/PList.pm
Sadly it's read only for now - been meaning to look at it again.
.. Gavin