News:

Wondering if this will always be free?  See why free is better.

Main Menu

[2.0.11][2.1]Previewing Bad/Missing Encoding

Started by nend, March 13, 2016, 12:14:07 AM

Previous topic - Next topic

nend

Hi,

On the preview JavaScript why don't we use encodeURIComponent instead of replace(/&#/g, \'&#\').php_to8bit().php_urlencode().

I am not saying this as a feature request, because the current setup has the script encoding wrong and sometimes halting on special Unicode characters.

I know it probably isn't going to be as easy as use a default JavaScript function compared to home brewed compatibility. I say this because there has to be a reason the team took a different route here, but I am not seeing it. From the looks here it looks like encodeURIComponent is the better option as it doesn't bug out from what I seen on these characters.

nend

Unless there is a reason for it being done this way when I get back home to my workstation in another 1.5 weeks, I will submit a commit to fix this in the 2.1 branch.

Any comments/concerns?

Arantor

It's that way for legacy reasons, for matching PHP's behaviours in terms of ISO encoding. If UTF-8 I believe it can be safely changed.

nend

I didn't consider ISO, that explains it.

So changing this should be safe in 2.1 but in 2.0 depending on the site setup may be problematic.

Thanks for the information, I been pondering about this.

Arantor

Sounds like a plan to me.

That's the terrible thing about ISO, is that it mangles a lot of stuff :(

Advertisement: