Register Guidelines E-Books Today's Posts Search

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

Notices

Reply
 
Thread Tools Search this Thread
Old 02-11-2016, 05:23 AM   #1
Phssthpok
Age improves with wine.
Phssthpok knows how to set a laser printer to stun.Phssthpok knows how to set a laser printer to stun.Phssthpok knows how to set a laser printer to stun.Phssthpok knows how to set a laser printer to stun.Phssthpok knows how to set a laser printer to stun.Phssthpok knows how to set a laser printer to stun.Phssthpok knows how to set a laser printer to stun.Phssthpok knows how to set a laser printer to stun.Phssthpok knows how to set a laser printer to stun.Phssthpok knows how to set a laser printer to stun.Phssthpok knows how to set a laser printer to stun.
 
Posts: 571
Karma: 95229
Join Date: Nov 2014
Device: Kindle Oasis, Kobo Libra II
Making "invisible"characters visible?

If I use characters such as ZWNJ or soft hyphens, I insert them as numeric entities &#xxx; in the text. However, the "smarten punctuation" tools replaces them by the actual characters, which are invisible. It is then impossible to find them and change them. My solution so far has been to leave out the hash marks (so "&xxx;" instead of "&#xxx;"), smarten the punctuation, and then re-insert the hash marks.

I have also come across similar problems in books which already contain invisible characters which mess up my formatting, and the only way I've found to deal with them is to paste the offending text into an old 8-bit-character editor (which displays any 16-bit characters as a question mark) so I can locate them, then go back to the Calibre editor and retype the text around the problem characters to delete them.

Would it be possible to change things somehow so that these "invisible" characters (which include others apart from zwnj and soft-hyphen, but I don't have a list) are always displayed as numeric entities in the editor to make them visible?
Phssthpok is offline   Reply With Quote
Old 02-11-2016, 11:06 AM   #2
kovidgoyal
creator of calibre
kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.
 
kovidgoyal's Avatar
 
Posts: 44,153
Karma: 22670164
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
This is not something I am willing to do. Its adds a lot of overhead (entites are replaced by characters at parsing stage in calibre so pretty much every automated action/tool will have this effect) for everyone for a relatively uncommon use case. I suggest you just create a couple of saved search and replace expressions, that substitute the characters with the entities. Then you can go from character->entity at the click of a button or two.
kovidgoyal is offline   Reply With Quote
Advert
Old 02-11-2016, 12:18 PM   #3
Phssthpok
Age improves with wine.
Phssthpok knows how to set a laser printer to stun.Phssthpok knows how to set a laser printer to stun.Phssthpok knows how to set a laser printer to stun.Phssthpok knows how to set a laser printer to stun.Phssthpok knows how to set a laser printer to stun.Phssthpok knows how to set a laser printer to stun.Phssthpok knows how to set a laser printer to stun.Phssthpok knows how to set a laser printer to stun.Phssthpok knows how to set a laser printer to stun.Phssthpok knows how to set a laser printer to stun.Phssthpok knows how to set a laser printer to stun.
 
Posts: 571
Karma: 95229
Join Date: Nov 2014
Device: Kindle Oasis, Kobo Libra II
Quote:
Originally Posted by kovidgoyal View Post
This is not something I am willing to do. Its adds a lot of overhead (entites are replaced by characters at parsing stage in calibre so pretty much every automated action/tool will have this effect) for everyone for a relatively uncommon use case. I suggest you just create a couple of saved search and replace expressions, that substitute the characters with the entities. Then you can go from character->entity at the click of a button or two.
OK. This is easy enough for soft hyphens, but seems to be impossible for ZWNJ. I can enter both ZWNJ and soft hyphens into the search dialog from the "Insert character"dialog, but unlike soft hyphens, a search for a ZWNJ always fails. (It also leaves me with the mystery of what the other invisible characters are that mess up my formatting, but that's a separate problem.)
Phssthpok is offline   Reply With Quote
Old 02-11-2016, 01:28 PM   #4
kovidgoyal
creator of calibre
kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.
 
kovidgoyal's Avatar
 
Posts: 44,153
Karma: 22670164
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
Using the Find expression

\u200c (regex mode)

works for me.
kovidgoyal is offline   Reply With Quote
Old 02-11-2016, 01:40 PM   #5
Phssthpok
Age improves with wine.
Phssthpok knows how to set a laser printer to stun.Phssthpok knows how to set a laser printer to stun.Phssthpok knows how to set a laser printer to stun.Phssthpok knows how to set a laser printer to stun.Phssthpok knows how to set a laser printer to stun.Phssthpok knows how to set a laser printer to stun.Phssthpok knows how to set a laser printer to stun.Phssthpok knows how to set a laser printer to stun.Phssthpok knows how to set a laser printer to stun.Phssthpok knows how to set a laser printer to stun.Phssthpok knows how to set a laser printer to stun.
 
Posts: 571
Karma: 95229
Join Date: Nov 2014
Device: Kindle Oasis, Kobo Libra II
Quote:
Originally Posted by kovidgoyal View Post
Using the Find expression

\u200c (regex mode)

works for me.
Ah. Of course. Thank you.

For anyone who's interested, the following regex-function replaces all matched characters with numeric entities:
Code:
def replace(match, number, file_name, metadata, dictionaries, data, functions, *args, **kwargs):
    result = ''
    for c in match.group():
        result += '&#%d;' % ord(c)
    return result
Search for e.g. (\u200c|\u00ad) and "replace all" using this function.

Last edited by Phssthpok; 02-11-2016 at 02:16 PM.
Phssthpok is offline   Reply With Quote
Advert
Reply


Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
PDF to WORD/HTML conversion, "special characters and marks" errors chengyibo PDF 3 11-06-2010 12:43 AM
Free - J.J. Luna's "How To Be Invisible". uRwhatUr Deals and Resources (No Self-Promotion or Affiliate Links) 6 01-30-2010 12:11 AM
UNUSEABLE free e-book "Invisible Armies" by Jon Evans on HarperCollin kacir Reading Recommendations 5 05-23-2008 06:26 PM


All times are GMT -4. The time now is 07:35 AM.


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