02-06-2011, 04:12 PM | #16 |
Guru
Posts: 657
Karma: 64171
Join Date: Sep 2010
Location: Kent, England, Sol 3, ZZ9 plural Z Alpha
Device: Sony PRS-300, Kobo Aura HD, iPad (Marvin)
|
Do a search and replace
Search for (\s)"(\w) (copy & paste a backward quote instead of the ") Replace with \1"\2 (copy & paste an open quote instead of the ") That should do it, step through a few first, and only if you're happy - replace all. Edit: Do this on the converted epub, with the incorrect 'smartquotes' Needless to say, make sure you have a backup |
02-07-2011, 08:14 AM | #17 |
Wizard
Posts: 1,247
Karma: 3439432
Join Date: Feb 2008
Device: Amazon Kindle Paperwhite (300ppi), Samsung Galaxy Book 12
|
Unfortunately, automated attempts at this will fail if typed quotes have been used to indicate inches: 5' 2" &c.
Such special characters have to have special treatment and should be marked as such (and of course for foot and inches one should use prime and double primes respectively). TEI has special tags to indicate begin / end quotes which allow for programmatic handling of them. Highly recommended. William |
Advert | |
|
02-07-2011, 11:18 AM | #18 | |
Well trained by Cats
Posts: 30,421
Karma: 58055868
Join Date: Aug 2009
Location: The Central Coast of California
Device: Kobo Libra2,Kobo Aura2v1, K4NT(Fixed: New Bat.), Galaxy Tab A
|
Quote:
space followed by quote followed by a word |
|
02-07-2011, 11:44 AM | #19 |
Guru
Posts: 657
Karma: 64171
Join Date: Sep 2010
Location: Kent, England, Sol 3, ZZ9 plural Z Alpha
Device: Sony PRS-300, Kobo Aura HD, iPad (Marvin)
|
If you've got some problems where an inch " has been replaced by a double-curly-quote
copy one of those curly quotes and paste it instead of the quote in this search (\s\d+?)"(\s) (Which is whitespace, followed by a number immediately followed by the quotemark, followed by whitespace) replace with \1"\2 (using the straight quote mark for inches) |
02-07-2011, 12:01 PM | #20 |
Well trained by Cats
Posts: 30,421
Karma: 58055868
Join Date: Aug 2009
Location: The Central Coast of California
Device: Kobo Libra2,Kobo Aura2v1, K4NT(Fixed: New Bat.), Galaxy Tab A
|
Perkin
My original was supposed to be a Positive feature comment, of not including those stray inches and feet |
Advert | |
|
02-07-2011, 12:31 PM | #21 |
Guru
Posts: 657
Karma: 64171
Join Date: Sep 2010
Location: Kent, England, Sol 3, ZZ9 plural Z Alpha
Device: Sony PRS-300, Kobo Aura HD, iPad (Marvin)
|
@theducks, I knew that, but wasn't sure about WillAdams's comment and if he wanted help.
|
02-08-2011, 12:13 PM | #22 | |
Enthusiast
Posts: 34
Karma: 2584
Join Date: Jan 2011
Device: Kindle
|
Quote:
Last edited by Rajmahid; 02-08-2011 at 12:17 PM. |
|
02-08-2011, 01:05 PM | #23 |
Wizard
Posts: 1,337
Karma: 123455
Join Date: Apr 2009
Location: Malaysia
Device: PRS-650, iPhone
|
I just found a file that exhibited this problem heavily today, and the root cause wasn't unbalanced quotes in the source file. It was actually spaces between the quoted text and the quotes. That really confuses the smartypants function.
A 'bad' example: " This is bad... " A 'good' example: "This is good..." There isn't really an easy way to fix this automatically with regex - I tried - you just need to go through the text and find places where there is an offending space. You can use a regex to make it simpler though: "\s+(?=\w) (?<=\W)\s+" (?<=\w)\s+" Just search through the text with those patterns, and replace with " when it's a real match. |
02-13-2011, 06:27 PM | #24 | |
Wizard
Posts: 3,388
Karma: 14190103
Join Date: Jun 2009
Location: Berlin
Device: Cybook, iRex, PB, Onyx
|
Quote:
But even after disguising these abbreviations Calibre won't convert the book properly - some sentences have the right quotations, others not, and I must admit there is only little logic to recognise which quotes Calibre converts correctly and which not. At the beginning of a paragraph there are mostly backward marks, inside a paragraph a dialogue sometimes starts with the right opening mark and sometimes not. All pairs of single quotes are converted correctly. I'm not sure if this is really a problem with the file or with Calibre. Last edited by Billi; 02-13-2011 at 06:50 PM. |
|
02-14-2011, 02:04 PM | #25 | |
Member
Posts: 19
Karma: 10
Join Date: Feb 2011
Device: Kindle
|
Quote:
I hope the author or Calibre takes a look to see what, if anything, can be done. Other than that, Calibre is one of the finest programs for avid ebook readers. Thank you! |
|
02-15-2011, 02:39 AM | #26 |
Wizard
Posts: 3,388
Karma: 14190103
Join Date: Jun 2009
Location: Berlin
Device: Cybook, iRex, PB, Onyx
|
Kovid, how does Calibre exactly convert the inch-signs? - Simply by counting, changing every first, third, fifth... sign to open quotation marks and every second, fourth, sixth to close quotation marks? - Or by analysing the chars around and applying some kind of script like that from Rylon in post 12 here? |
02-15-2011, 03:22 AM | #27 | ||
eBook Enthusiast
Posts: 85,544
Karma: 93383043
Join Date: Nov 2006
Location: UK
Device: Kindle Oasis 2, iPad Pro 10.5", iPhone 6
|
Quote:
Quote:
|
||
02-15-2011, 08:28 AM | #28 |
eBook Enthusiast
Posts: 85,544
Karma: 93383043
Join Date: Nov 2006
Location: UK
Device: Kindle Oasis 2, iPad Pro 10.5", iPhone 6
|
Here are two test files, so we can see whether it's using non-breaking spaces for indentation that causes the problem. Look at the three final stories in the book to find dialogue with quotes.
"test_space.prc" uses non-breaking spaces for identation. "test_indent.prc" is the same book using "real" indents. Does the Calibre "smart quote" feature break for either or both of these? |
02-15-2011, 10:23 AM | #29 |
creator of calibre
Posts: 44,428
Karma: 24044628
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
|
I didn't write this code, calibre just uses the smartypants library, though generally speaking I don't see how it's possible to design an algorithm that can get this transformation right in every case. The algorithm would need to understand the language to get it perfectly right, that's why this option is off by default. If it works for your books, you're lucky, if not, you have to fix them manually.
|
02-15-2011, 10:47 AM | #30 |
eBook Enthusiast
Posts: 85,544
Karma: 93383043
Join Date: Nov 2006
Location: UK
Device: Kindle Oasis 2, iPad Pro 10.5", iPhone 6
|
These test uploads are to try to assist someone who's having trouble with my eBooks, Kovid. It was suggested that the fact that the paragraphs start with non-breaking spaces may cause issues to the smart-quote algorithm.
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
"A Problem Occurred" on the "Shop" page. | swallman | Nook Color & Nook Tablet | 1 | 12-25-2010 12:34 PM |
Sudden Problem with "The" and "A" Titles | Otter | Calibre | 13 | 09-05-2010 08:32 PM |
Engadget:Toshiba Shows off "Smart Pad" promises launch before October | kjk | News | 3 | 07-20-2010 07:18 PM |
Classic Australian Daily Telegraph "Smart Edition" and the nook? | firefox | Barnes & Noble NOOK | 0 | 07-19-2010 02:50 AM |
An explanation for the "Oops, We're Working On Your problem," page at the Sony Store | Dr. Drib | Sony Reader | 2 | 07-25-2009 07:40 AM |