Jump to content

Encodeuricomponent Function Replacing “ And ” With “ And â€�


Greywacke
 Share

Recommended Posts

a short little test actually revealed that the following javascript code is what actually created this issue.

(%E2%80%9C%20and%20%E2%80%9D)
was alerted by opening the following javascript protocol
alert(encodeURIComponent("(“ and ”)"));
as a url in firefox.which other functions can encode a string containing double quotes without replacing them with multiple weird chars?this issue was posted at first under the PHP forum (http://w3schools.invisionzone.com/index.php?showtopic=30419). Edited by Pierre 'Greywacke' du Toit
Link to comment
Share on other sites

i tried that, but it replaces them with ? *sighs*unless you meant the utf8_decode as a javascript function, and not in the php AJAX handler where i implemented it...

Edited by Pierre 'Greywacke' du Toit
Link to comment
Share on other sites

this issue has been resolved by adding a function in the form handler to convert the messed up characters to the originally input ones.

function rep_lrdquotes($string) {	return str_replace("â€","”",str_replace("“","“",$string));}

thanks for all the attempted help!

Edited by Pierre 'Greywacke' du Toit
Link to comment
Share on other sites

which other functions can encode a string containing double quotes
The problem is that those aren't actually double quotes, they're some high-value unicode characters. Unicode is a multi-byte character set, so those characters require 3 bytes each. Those are the multiple characters you see when the 3 bytes get displayed as ASCII.
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...