Page 1 of 1

escaping special characters during export?

Posted: Tue Feb 23, 2010 10:36 am
by maik
Hi,

does someone know how I can escape characters like single-quote (') or double-quote (") in my exported data? The text in my summary field frequently contains these characters and they mess up my JSON...

Cheers,
-Maik

Re: escaping special characters during export?

Posted: Wed Feb 24, 2010 7:01 am
by Conor
If your using a text template export then use an Automator action to find and replace the quotes. The pedias do encoding for HTML but this is not the same as the JSON escape done with back-slash.

P.S. The only character from your set than needs escaping is the double quote, single quote is okay. See sidebar under char heading.

Re: escaping special characters during export?

Posted: Wed Feb 24, 2010 8:34 am
by maik
Hi Conor,

thanks, that's a viable alternative. I have also been thinking of querying the DB from an external application and then doing my own export. Is this a dumb idea? According to the documentation at sqlite.org multiple applications can query the same DB at the same time, so I guess I wouldn't even have to make sure that DVDpedia is not running, right? Also, I believe I should be able to find updated entries by querying the ZENTRY.ZDATEEDITED value and then update entries in my data based on the Z_PK value (or is it ZUID)?

I'm asking all this because I am currently toying around with creating a WebApp export for iPhone and am looking for an easy way to make the data available before uploading it to e.g. MobileMe.

Cheers,
-Maik

Re: escaping special characters during export?

Posted: Mon Mar 01, 2010 12:14 pm
by Conor
That will indeed work and there is no need to quit DVDpedia especially since with read only operations on the database. Both the Z_PK and ZUID will work. The first is the internal Core Data ID while the second is our own unique ID. The second one has the advantage that it's also the cover image name, if you want automate copying those over as well.