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

To: Robert DeLong
Here's what's interesting.

Type an apostrophe into the Your Reply box.

click Preview.

Now copy the apostrophe from the "if you posted your comment" box and paste it back into the Your Reply box.

click Preview.

The pasted apostrophe is now garbage code.


31 posted on 10/31/2015 12:33:27 AM PDT by 867V309 (Trump: Bull in a RINO Shoppe)
[ Post Reply | Private Reply | To 30 | View Replies ]


To: 867V309

From what I understand, the quote you entered is converted and displayed as you intended, however, the number code generated has the additional characters embedded in it. Thus when you copy & paste it, the conversion then has the extra embedded characters to now convert. I know that’s confusing, and since I am not really an expert on how these conversions actually work, I may be wrong in my explanation. But it is the only thing that makes sense. In other words I am making an educated guess based on what my researching has identified as to what is happening to cause these issues.


45 posted on 10/31/2015 8:18:17 AM PDT by Robert DeLong (u)
[ Post Reply | Private Reply | To 31 | View Replies ]

To: 867V309
That's perverse!

FR's posting input processor has two modes: lazy mode and HTML mode. In lazy mode, it tries to add enough HTML to make your post look more or less the way you typed it. In HTML mode, it strips out stuff like CSS and JavaScript and makes sure the likes of <i> get closed if any are left open. But, otherwise, it's up to you how your post formats.

Apparently, one of the features of lazy mode is smart quoting. (Your example works in lazy mode, but not in HTML mode.) In lazy mode, if you type straight-up ASCII quotes, it converts them to left and right curly quotes. E.g., if you type "Smart quotes in lazy mode!", hit Preview, and view the source of the page that comes back, you see that the server has converted your straight, 7-bit ASCII quotes into left and right curlies:

<DIV CLASS=body><p>&#8220;Smart quotes in lazy mode!&#8221;</p></DIV>

If you copy the text echoed in the preview window to the clipboard and feed it through a hex dumper, you see that the smart quotes have been replaced by the appropriate three-byte UTF-8 sequences:

$ pbpaste|xxd
0000000: e280 9c53 6d61 7274 2071 756f 7465 7320  ...Smart quotes 
0000010: 696e 206c 617a 7920 6d6f 6465 21e2 809d  in lazy mode!...

If you now paste that text back into the input window and retry the Preview, the HTML for the preview window looks like this:

<DIV CLASS=body><p>&acirc;&#128;&#156;Smart quotes in lazy mode!&acirc;&#128;&#157;</p></DIV>

The server has converted the individual bytes of the three-byte UTF-8 characters to entity codes, resulting in crud:

“Smart quotes in lazy mode!”

The bug is that the server is mangling UTF-8 sequences on input.

58 posted on 10/31/2015 4:51:41 PM PDT by cynwoody
[ Post Reply | Private Reply | To 31 | 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