When some of my users were using my system to send emails, they’d often copy-and-paste their messages from their favourite word processor, but when my system sent the emails they’d have question marks dotted around, e.g.
“Why doesn’t this work?”
would get changed to
?Why doesn?t? this work??
Simple fix was to detect and replace those fancy-pants quote characters with the equivalent html entities, e.g.:
function enc_chars (m in varchar2) return varchar2 is begin return replace(replace(replace(replace(m ,chr(14844060),'“')/*left double quote*/ ,chr(14844061),'”')/*right double quote*/ ,chr(96) ,'‘')/*left single quote*/ ,chr(14844057),'’')/*right single quote*/ ; end enc_chars;
P.S. Stupid wordpress keeps mucking around with my code, trying to replace the html entities with the unencoded versions. In case this doesn’t work, here’s an image of what the above code is supposed to look like: