Free Republic
Browse · Search
General/Chat
Topics · Post Article

To: cynwoody

Quick question; would the Find/Replace command work?


39 posted on 10/31/2015 6:10:27 AM PDT by Cletus.D.Yokel (BREAKING: Boy Scouts of America Changes Corporate Identity to "Scouting for Boys in America")
[ Post Reply | Private Reply | To 36 | View Replies ]


To: Cletus.D.Yokel
Quick question; would the Find/Replace command work?

Yes, but it would be tedious.

As a minimum, you could replace each curly quote or apostrophe with a straight ASCII double or single quote and each em-dash with '--', etc. A more advanced approach would replace each non-ASCII character with the corresponding HTML entity. E.g., you would replace the left curly quote with “, the right with ”, etc.

You could also automate the process with the following JavaScript function:

function entify(s) {
    var result = '';
    for (var x=0; x<s.length; x++) {
        var c = s.charCodeAt(x);
        result += c < 128 ? s[x] : '&#' + c + ';';
    }
    return result;
}

Copy it into your browser's JavaScript console and feed it, say, entify('“refugee”'). It will return '&#8220;refugee&#8221;', which will display correctly (8220 and 8221 are the numeric equivalents of ldquo and rdquo).

But there's an additional problem: It will only display correctly for one generation. As soon as somebody tries to quote your post in a reply, it will be back to the circumflex-A, Euro sign garbage (unless they also perform the entification process.

47 posted on 10/31/2015 2:10:42 PM PDT by cynwoody
[ Post Reply | Private Reply | To 39 | View Replies ]

Free Republic
Browse · Search
General/Chat
Topics · Post Article


FreeRepublic, LLC, PO BOX 9771, FRESNO, CA 93794
FreeRepublic.com is powered by software copyright 2000-2008 John Robinson