By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
437,949 Members | 1,855 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 437,949 IT Pros & Developers. It's quick & easy.

%da is translated before getting to php

P: n/a
Hi,

I'm trying help someone who has a simple search box on their php
web page, into which you can enter an SQL query. The problem is that
sometimes "%da" is interpreted into an accented capital U, as if some
unicode translation was happening somewhere.

It's looks like the translation is already there by the time we
examine http_submit_vars. Is it a setting of the brower ? That seems
unlikely because the URL appears ok in the apache log. I decided it
must be some setting in php.ini, but the only thing that looked like
it might apply was the magic_quotes_gpc setting, and I tried it both
ways and I still have the problem.

Has anyone seen this before ?

--Rob
Jul 17 '05 #1
Share this Question
Share on Google+
1 Reply


P: n/a
Rob Ristroph wrote:
I'm trying help someone who has a simple search box on their php
web page, into which you can enter an SQL query. The problem is that
sometimes "%da" is interpreted into an accented capital U, as if some
unicode translation was happening somewhere.

It's looks like the translation is already there by the time we
examine http_submit_vars. Is it a setting of the brower ? That seems
unlikely because the URL appears ok in the apache log. I decided it
must be some setting in php.ini, but the only thing that looked like
it might apply was the magic_quotes_gpc setting, and I tried it both
ways and I still have the problem.


This is a character-encoding problem.

If %da is interpreted in iso-8859-1 it will be shown as the accented
capital U

<?php
$x = isset($_GET['data']) ? $_GET['data'] : '(no data)';
header('Content-Type: text/html; charset=iso-8859-1');
echo '<html><head><title>test</title></head><body>';
echo '<p>data is represented as: ', $x, '.</p>';
echo '<p>in hexadecimal that is: ', bin2hex($x), '.</p>';
echo '</body></html>';
?>

Now go to this page with some data in the URL

page.php?data=ooo%daooo
page.php?data=ooo%25daooo
Change charset to one of ( utf-8 | us-ascii | big5 | ... )
and see the differences :-)
--
USENET would be a better place if everybody read: | to email me: use |
http://www.catb.org/~esr/faqs/smart-questions.html | my name in "To:" |
http://www.netmeister.org/news/learn2quote2.html | header, textonly |
http://www.expita.com/nomime.html | no attachments. |
Jul 17 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.