View Single Post
Old 02-07-2014, 04:03 AM   #3
ZioNemo
Enthusiast
ZioNemo began at the beginning.
 
Posts: 48
Karma: 10
Join Date: Mar 2008
Device: HTC-p3000
Quote:
Originally Posted by kovidgoyal View Post
somewhere in there you are passing a string that starts with - but is not actually an option.

Unfortunately it's not so easy.

I need to pass over to calibredb, at least for the "comments" field an arbitrary string which may (and sometime DOES) contain any charachter, including comma( , ), colon( : ), semicolon( ; ), quotes( " ), accented letters and whitespace, including newlines.
I pass those as a a single string in the argument array, but that does not seem enough because calibredb further parses that string (at the very least to detect commas and colons) and I don't know details of that parsing.

Normal practice, in such cases, is to escape troublesome characters, but I don't know IF such a practice is implemented in calibredb and, if so, HOW it is implemented.

I tried to have a brief look to sources, but I didn't find the calibredb "main" or wherever argument parsing is performed.

Note: I have no control over comments format: it's already there and I didn't write it. I can filter it, but I should try to preserve it as much as possible; just deleting "troublesome" chars (what is the complete list?) is not a good idea because it would make some comments very hard to read. Escaping them is something I can do easily, but needs calibredb "cooperation".
ZioNemo is offline   Reply With Quote