View Single Post
Old 02-11-2020, 06:01 PM   #29
DNSB
Bibliophagist
DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.
 
DNSB's Avatar
 
Posts: 46,613
Karma: 169712392
Join Date: Jul 2010
Location: Vancouver
Device: Kobo Sage, Libra Colour, Lenovo M8 FHD, Paperwhite 4, Tolino epos
Quote:
Originally Posted by JSWolf View Post
Mind posting your steps please? Thanks.
It's a pretty simplistic solution. First I convert the 4 flavours of curly quotes into strings of ~ and % and then convert those back into curly quotes.

“ => ~%~% => ‘
” => %~%~ => ’
‘ => ~%%~ => “
’ => %~~% => ”

So the sentence I used in my sample comes out looking like after the first pass:

Code:
<p>John said ~%%~I asked Bill and he said ~%~%You should be ashamed of yourself.%~%~ %~~%</p>
I do check first to make sure that someone has not used one of those strings but so far, that has not happened. I also use a cleanup search for a double curly quote between two letters which gets replaced by a right single curly quote if needed. Given that you should never see a curly quote in the code segment, this pretty much covers my needs. These are part of my saved searches.

Last edited by DNSB; 02-11-2020 at 06:06 PM. Reason: Added sample sentence from previous post
DNSB is online now   Reply With Quote