Editor: HTML entities replacement doesn't work in Calibre 64-bit for windows
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
| calibre |
Undecided
|
Unassigned |
Bug Description
The summary tells you everything ;-)
The new feature doesn't work in my Calibre 64-bit installation. BUT it correctly works in my Calibre 32-bit installation.
(Entities are nevertheless correctly rendered and identified in editor (in italics light grayish blue) and HTML fix/Beautify do replace them).
Running 1.17 on Vista 64-bit.
arspr (arspr) wrote : | #2 |
Nope. More over, I've changed between my recently installed 32 bit version and my old 64 bit version without modifying any setting...
I'll perform more tests just in case I made some mistake or if it happens only in one book but not in others...
(I also explicitly tested with … as is the example you give in the flyover help of the option)
arspr (arspr) wrote : | #3 |
I've double- and triple-checked and I always get the issue in Calibre 64-bit (either running from source or running normally).
I'm going to post a thread in Mobileread.
Nevertheless, remember that I have set a development environment on my PC. So I you guide me, I can try debugging it...
(And another related comment: XML entities " and ' are not automatically converted into " and ' when typing, but they are when Beautifying or when Fixing HTML. Incoherent behaviour here?)
Kovid Goyal (kovid) wrote : | #4 |
It is not always safe to replace the ' and " entities, it can lead to invalid markup. Fix HTML can easily detect such situations and avoid them. The live replace in the editor cannot.
If you wish to debug it, in the file editor/text.py look at the function replace_
calibre-debug -t file.epub
from a console. This will allow you to see the output from the print statements. To start with, see what values the variables text and m have, like this:
print (text, m) (insert a new line after line 555)
arspr (arspr) wrote : | #5 |
Done.
I attach a screenshot which covers both runs.
When running Calibre 32 bit and typing a … I automatically get:
8 … <_sre.SRE_Match object at 0x05167E20>
And the … is converted.
But when running Calibre 64 bit, just when it is opened I get an error:
C:\Program Files\Calibre2\
Then nothing happens when I type … on the Test.epub example.
Any more instructions?
Kovid Goyal (kovid) wrote : | #6 |
If nothing is happening, that means teh function is not being called, the only way I can see for that to happen is if you have the preference turned off. See line 548 just above that function.
arspr (arspr) wrote : | #7 |
I don't know what I'm exactly doing, but I think there's something weird.
I copy my current text.py around that area so you can see what I've modified (just two added prints):
def keyPressEvent(self, ev):
print (ev.key(), Qt.Key_Semicolon, tprefs[
if ev.key() == Qt.Key_Semicolon and tprefs[
def replace_
c = self.textCursor()
text = unicode(
m = entity_
print (text, m)
if m is None:
And then as the screenshot shows the problem is that ev.key() for ";" is 44, but Qt.Key_Semicolon is 59 when running Calibre 64-bit. In Calibre 32-bit ";" key is also 59.
Any more tests?
Kovid Goyal (kovid) wrote : Fixed in master | #8 |
Fixed in branch master. The fix will be in the next release. calibre is usually released every Friday.
status fixreleased
Changed in calibre: | |
status: | Invalid → Fix Released |
I cannot reproduce on my windows 7 64 bit machine. Entity replacement
works in HTML files, for example typing … replaces automatically
with ellipsis aftertyping the ;. Are you sure you did not turn it off in
preferences accidentally?
status invalid