%da is translated before getting to php

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Rob Ristroph

    %da is translated before getting to php

    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_var s. 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_gp c setting, and I tried it both
    ways and I still have the problem.

    Has anyone seen this before ?

    --Rob
  • Pedro Graca

    #2
    Re: %da is translated before getting to php

    Rob Ristroph wrote:[color=blue]
    > 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_var s. 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_gp c setting, and I tried it both
    > ways and I still have the problem.[/color]

    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><t itle>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=o oo%daooo
    page.php?data=o oo%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. |

    Comment

    Working...