View Single Post
Old 06-20-2012, 08:44 PM   #29
DiapDealer
Grand Sorcerer
DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.
 
DiapDealer's Avatar
 
Posts: 8,889
Karma: 39965569
Join Date: Jan 2010
Device: Nexus 7, Kindle Fire HD
With regard to the select char->entity substitution not working on Windows platforms:

The following modifications to the "src/Sigil/ResourceObjects/HTMLResource.cpp" file would seem to remedy that. I've only been able to test it (in an admittedly very limited fashion) on the Windows and Linux platforms (my OS X dev machine is misbehaving ATM), but no adverse affects thus far from simply using the UTF-8 hex representation of the characters in place of of the "\uXXXX" unicode codepoint.

Code:
--- Sigil-0.5.902-Code/src/Sigil/ResourceObjects/HTMLResource-orig.cpp	Tue Jun 19 19:39:38 2012
+++ Sigil-0.5.902-Code/src/Sigil/ResourceObjects/HTMLResource.cpp	Wed Jun 20 20:05:26 2012
@@ -178,9 +178,9 @@
 {
     QString newsource = source;
 
-    newsource = newsource.replace( QString::fromUtf8( "\u00ad" ), "& shy;" );
-    newsource = newsource.replace( QString::fromUtf8( "\u2014" ), "—" );
-    newsource = newsource.replace( QString::fromUtf8( "\u2013" ), "–" );
+    newsource = newsource.replace( QString::fromUtf8( "\xc2\xad" ), "& shy;" );
+    newsource = newsource.replace( QString::fromUtf8( "\xe2\x80\x94" ), "—" );
+    newsource = newsource.replace( QString::fromUtf8( "\xe2\x80\x93" ), "–" );
 
     return newsource;
 }
Do with that what you will.

I apologize for the "& shy;" the forum won't let me type the actual entity without weird things happening. There's obviously unneccessary spaces in my patch that would have to be removed.

Last edited by DiapDealer; 06-20-2012 at 09:05 PM.
DiapDealer is offline