Register Guidelines E-Books Search Today's Posts Mark Forums Read

Go Back   MobileRead Forums > E-Book Software > Calibre > Editor

Notices

Reply
 
Thread Tools Search this Thread
Old 02-10-2020, 05:58 PM   #1
JLID10
Junior Member
JLID10 began at the beginning.
 
Posts: 4
Karma: 10
Join Date: Feb 2020
Device: Supernote A6
How to find and replace text?

Due to some issues with my ereader, I have to format the quote marks on my ebooks to be straight (') and not curly (’). Some of my ebooks have the curly quote marks (’) by default, and I am wondering if there is a quick way in calibre to find and replace all of the curly quotes with straight ones. I noticed there is a tool called "smarten punctuation" but it does the opposite of what I need it to do.

Any ideas?
JLID10 is offline   Reply With Quote
Old 02-10-2020, 06:17 PM   #2
hobnail
Running with scissors
hobnail ought to be getting tired of karma fortunes by now.hobnail ought to be getting tired of karma fortunes by now.hobnail ought to be getting tired of karma fortunes by now.hobnail ought to be getting tired of karma fortunes by now.hobnail ought to be getting tired of karma fortunes by now.hobnail ought to be getting tired of karma fortunes by now.hobnail ought to be getting tired of karma fortunes by now.hobnail ought to be getting tired of karma fortunes by now.hobnail ought to be getting tired of karma fortunes by now.hobnail ought to be getting tired of karma fortunes by now.hobnail ought to be getting tired of karma fortunes by now.
 
Posts: 287
Karma: 2114514
Join Date: Nov 2019
Device: none
Select the book in Calibre. Tap the t key to open it in the editor. In the editor in the left column double click on the file for the first chapter where you want it to start; it will fix all following chapters as well. In the big pane where the chapter contents is find the first quote and drag over it to select it (and only it). Then do control F and that will bring up the search and replace box below. The quote you selected will be filled in in the Find: box. In the Replace: box type in the replacement quote. In the mode line below change the drop down to All text files; the third drop down should be Down. Click on the Replace All button. Repeat for the other quote.

Keep your fingers crossed and hope it doesn't screw anything up in the html header at the top; the stuff with angle brackets.
hobnail is offline   Reply With Quote
Advert
Old 02-10-2020, 07:06 PM   #3
JLID10
Junior Member
JLID10 began at the beginning.
 
Posts: 4
Karma: 10
Join Date: Feb 2020
Device: Supernote A6
Worked, thank you
JLID10 is offline   Reply With Quote
Old 02-13-2020, 09:08 PM   #4
Tex2002ans
Wizard
Tex2002ans ought to be getting tired of karma fortunes by now.Tex2002ans ought to be getting tired of karma fortunes by now.Tex2002ans ought to be getting tired of karma fortunes by now.Tex2002ans ought to be getting tired of karma fortunes by now.Tex2002ans ought to be getting tired of karma fortunes by now.Tex2002ans ought to be getting tired of karma fortunes by now.Tex2002ans ought to be getting tired of karma fortunes by now.Tex2002ans ought to be getting tired of karma fortunes by now.Tex2002ans ought to be getting tired of karma fortunes by now.Tex2002ans ought to be getting tired of karma fortunes by now.Tex2002ans ought to be getting tired of karma fortunes by now.
 
Posts: 1,493
Karma: 7088651
Join Date: Jul 2012
Device: Kobo Forma, Nook
Quote:
Originally Posted by JLID10 View Post
I am wondering if there is a quick way in calibre to find and replace all of the curly quotes with straight ones. I noticed there is a tool called "smarten punctuation" but it does the opposite of what I need it to do.
Also, if you're doing a Calibre conversion, under Look & Feel > Text, there's a little checkbox for UnSmarten Punctuation.

That will convert your book and change all smart quotes into their dumb equivalents.

Quote:
Originally Posted by JLID10 View Post
Due to some issues with my ereader, I have to format the quote marks on my ebooks to be straight (') and not curly (’).
May I ask what the exact issue is?
Tex2002ans is online now   Reply With Quote
Old 02-14-2020, 09:46 AM   #5
JLID10
Junior Member
JLID10 began at the beginning.
 
Posts: 4
Karma: 10
Join Date: Feb 2020
Device: Supernote A6
Quote:
Originally Posted by Tex2002ans View Post
May I ask what the exact issue is?
The ereader (supernote) is primarily used in Chinese and Japanese so there's still a few bugs with the english version. For some reason theres always a space after every smart apostrophe or quote mark, it started getting kind of annoying so I decided to figure out some way to fix it.
Attached Thumbnails
Click image for larger version

Name:	IMG_1225.jpg
Views:	45
Size:	303.7 KB
ID:	177143  
JLID10 is offline   Reply With Quote
Advert
Old 02-14-2020, 06:11 PM   #6
Tex2002ans
Wizard
Tex2002ans ought to be getting tired of karma fortunes by now.Tex2002ans ought to be getting tired of karma fortunes by now.Tex2002ans ought to be getting tired of karma fortunes by now.Tex2002ans ought to be getting tired of karma fortunes by now.Tex2002ans ought to be getting tired of karma fortunes by now.Tex2002ans ought to be getting tired of karma fortunes by now.Tex2002ans ought to be getting tired of karma fortunes by now.Tex2002ans ought to be getting tired of karma fortunes by now.Tex2002ans ought to be getting tired of karma fortunes by now.Tex2002ans ought to be getting tired of karma fortunes by now.Tex2002ans ought to be getting tired of karma fortunes by now.
 
Posts: 1,493
Karma: 7088651
Join Date: Jul 2012
Device: Kobo Forma, Nook
Quote:
Originally Posted by JLID10 View Post
For some reason theres always a space after every smart apostrophe or quote mark, it started getting kind of annoying so I decided to figure out some way to fix it.
Thanks for the picture.

Are your books marked with the proper language lang + xml:lang in the HTML?

Code:
<html lang="en" xml:lang="en">
Is your book marked as English in the EPUB metadata? (dc:language "en")

And what exact ereader is this?

Does it happen if you embed/use a different font to display your ebook?

Quote:
Originally Posted by JLID10 View Post
The ereader (supernote) is primarily used in Chinese and Japanese so there's still a few bugs with the english version.
Hmmmm... it seems like the font could be accidentally rendering it as a full-width character.

For example, see Wikipedia article on "Chinese Punctiaton":

Quote:
In Simplified Chinese, the European-style quotation marks are always used in horizontal text. Here, single quotation marks are used when embedded within double quotation marks: “…‘…’…”. These quotation marks are fullwidth in printed matter but share the same codepoints as the European quotation marks in Unicode, so they require a Chinese-language font to be displayed correctly.
or this bug in Word:

https://answers.microsoft.com/en-us/...9b31bf5&page=6

I remember seeing LibreOffice locale bugs about similar things over the years too. If I remember correctly, it's usually something along these lines:

"Computer/OS/Program set to Asian language, trying to type book in English. Program/Font is still making Asian typography assumptions."

Technical Note: It could also be built into the OpenType fonts in your device itself... there are OpenType features like:

Quote:
fwid = Full Widths: Substitutes proportionally spaced character with full-width versions (esp. for Latin letters within Chinese)
Also see Microsoft's OpenType fwid explanation:

Spoiler:
Quote:
Tag: 'fwid'
Friendly name: Full Widths

Registered by: Adobe

Function: Replaces glyphs set on other widths with glyphs set on full (usually em) widths. In a CJKV font, this may include “lower ASCII” Latin characters and various symbols. In a European font, this feature replaces proportionally-spaced glyphs with monospaced glyphs, which are generally set on widths of 0.6 em.

Example: The user may invoke this feature in a Japanese font to get full monospaced Latin glyphs instead of the corresponding proportionally-spaced versions.

Recommended implementation: The font may contain alternate glyphs designed to be set on full widths (GSUB lookup type 1), or it may specify alternate (full-width) metrics for the proportional glyphs (GPOS lookup type 1).

Application interface: For GIDs found in the 'fwid' coverage table, the application passes the GIDs to the table and gets back either new GIDs or positional adjustments (XPlacement and XAdvance).

UI suggestion: This feature would normally be off by default.

Script/language sensitivity: Applies to any script which can use monospaced forms.

Feature interaction: This feature is mutually exclusive with all other glyph-width features (e.g. 'tnum', 'halt', 'hwid', 'palt', 'pwid', 'qwid' and 'twid'), which should be turned off when it’s applied. It deactivates the 'kern' feature.


which is why I suggest embedding a different font and seeing if that works.

Last edited by Tex2002ans; 02-14-2020 at 06:36 PM.
Tex2002ans is online now   Reply With Quote
Old 02-14-2020, 06:58 PM   #7
JLID10
Junior Member
JLID10 began at the beginning.
 
Posts: 4
Karma: 10
Join Date: Feb 2020
Device: Supernote A6
Quote:
Originally Posted by Tex2002ans View Post
And what exact ereader is this?
Thanks for the info. Here's the website of the product. I actually contacted them and they said they would create a new font on the device that would fix the issue by the end of the month. For now it's easy enough just to unsmarten the punctuation because it fixes the spacing. Changing the font in Calibre doesn't seem to affect anything because the device seems to use its own fonts. I'll keep experimenting, I'm still very new to editing ebooks and understanding the html and such.
JLID10 is offline   Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Behaviour of history and spaces in find/replace text boxes arspr Editor 0 01-01-2014 05:04 PM
Find/Replace text into both dialog boxes Steadyhands Sigil 5 02-25-2013 02:51 PM
Find/Replace Won't Find Rand Brittain Sigil 7 09-24-2011 04:35 AM
Need Text editor for specific Find/Replace Regular Expression scubaddictions Workshop 11 08-17-2011 07:58 PM
Find/Replace bogus line breaks in Text editor, w/Regular Expression scubaddictions Conversion 15 07-21-2011 08:52 AM


All times are GMT -4. The time now is 10:38 PM.


MobileRead.com is a privately owned, operated and funded community.