Quote:
|
Originally Posted by erick_the_redd
But one solution to dealing with the query string issue is to use the PHP function: htmlspecialchars_decode. That will cover the &, back into straight &, without having to do anything special.
|
Am already using htmlspecialchars_decode to convert special chars. But it does not appear to be converting or recognizing '.
Am using the the follwoing to encode the query string:
Code:
htmlspecialchars($link, ENT_QUOTES)
Heres the encoded querystring - not how the apostrophe has been encoded:
PHP Code:
test.php?SearchResults&SearchString=flower\'s&AllWords=off&Page=1
note: in the above there should be a backslash after flower (\ & # 039

but the editor on dbforums keeps converting it as above despite using the code tags!
Am using the following to decode the query string:
Code:
htmlspecialchars_decode($queryString, ENT_QUOTES)
it seems to decode other special chars e.g double quotes such as flower"s but not single quotes such as flower's.
I think it is an issue with the html_translation_table used. see below and note the difference in the single quotes:
Code:
Proof:
Code:
--------------------
<?php
var_dump(get_html_translation_table(HTML_SPECIALCHARS,ENT_QUOTES));
var_dump(htmlspecialchars('\'',ENT_QUOTES));
?>
--------------------
Output:
--------------------
array
'"' => """
''' => "'" <- should be showing as & # 39; without the spaces
'<' => "<"
'>' => ">"
'&' => "&"
"'" <- should be showing as & # 039; without the spaces
--------------------
However even when I manually edit the query string in the url by removing the 0 from ' and hitting refresh it still doesnt work???? Also I am unable to show what is happening because the editor on dbforms converts the array output above into aprostrophes! See this link instead
PHP: htmlspecialchars_decode - Manual