View Single Post
Old 11-13-2010, 04:26 AM   #60
chaley
Grand Sorcerer
chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.
 
Posts: 11,741
Karma: 6997045
Join Date: Jan 2010
Location: Notts, England
Device: Kobo Libra 2
Quote:
Originally Posted by ldolse View Post
I was doing some research/testing on this - just posting it here for when you get back online, or in case there is another PHP expert out there with some input.

There are lots of discussions out there indicating PHP just doesn't behave well with single quotes in directories/filenames. Unfortunately the most frequent recommended solution is to not use them, which isn't really acceptable since these map to Calibre titles.

My first thought was to work around this using various unicode apostrophe alternatives. I was hoping Calibre would convert these to underscores like it does some other characters. Unfortunately Calibre was too smart for me and mapped these to ascii single quotes at the filesystem level.

I dug further into the PHP code to see what was going on. Single quotes are handled a bit oddly. While the encoded URL shows just only the single quote, when I actually print the $path variable it's showing up a bit oddly:
Code:
 Douglas Adams/Dirk Gently/'s Holistic Detective Agency (754)/cover.jpg
I tried doing a str_replace - converting "/'" to "'". The replacement itself seems to have worked, but the file still was not found at the new path.

Regarding magic_quotes_gpc, I haven't had much luck completely disabling that, following the directions for disabling it using .htaccess didn't seem to work, though magic_quotes_runtime is disabled - maybe that's all that's required. Nothing I've changed there has made a difference though.
I will change the server to use calibres ID, which is numeric. That costs an extra DB lookup, but it eliminates the problem. (brief because very slow wireless on phone)
chaley is offline   Reply With Quote