On Втр, Ноя 19, 2002 at 10:01:36 +0200, [EMAIL PROTECTED] wrote:
> Quoting "Andre E. Bar'yudin" <[EMAIL PROTECTED]>:
> 
> 
> > I assume that the
> > problem is related to how PHP handles the response from your browser.
> > Mozilla probably doesn't provide the response character set, during form
> > submission and Konqueror does, hence the difference between them.  Now,
> > when PHP doesn't have a response content type it probably assumes some
> > default (say, iso-8859-1) and escapes every out-of-the-range character
> > by HTML entities.

I've repeated your test, with a little correction to the meta tag.  My
HTML reads:

<HTML>
    <HEAD>
          <TITLE>Test</TITLE>
 <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    </HEAD>
    <BODY>
          <FORM ACTION="cgi-bin/test.sh" METHOD="POST">
            <INPUT TYPE="text" NAME="foobar" SIZE="50"><BR>
            <INPUT TYPE="submit" VALUE="send">
        </FORM>
    </BODY>
</HTML>

The test.sh script is the exact copy of yours.  The output for the
Hebrew word "ivrit" reads:

foobar=%D7%A2%D7%91%D7%A8%D7%99%D7%AA

Browser version:
Mozilla/5.0 (X11; U; Linux i686; ru-RU; rv:1.2b) Gecko/20021017

Now, when I put YOUR meta-tag, the result for the same input is:

foobar=%26%231506%3B%26%231489%3B%26%231512%3B%26%231497%3B%26%231514%3B

which corresponds to your results.

The reason is, that in my opinion "utf8" is not a legal codepage name
(at least for Mozilla, although Java eats it as an alias to UTF-8, as
far as I remember).  Probably Konqueror does support this name too.

So, maybe the original poster just made the same mistake - used
something else instead of "UTF-8" as his charset option.

Regards,

Andre.

> OK, a little test - which I told Arye to do, but decided to do myself: I wrote a
> small CGI:
> 
> #!/bin/bash
> echo "Content-type: text/plain"
> echo
> cat -
> 
> And I created a small form:
> 
> <HTML>
>     <HEAD>
>         <TITLE>Test</TITLE>
>         <META HTTP-EQUIV="Content-type" VALUE="text/html; Charset=utf8">
>     </HEAD>
>     <BODY>
>         <FORM ACTION="cgi-bin/foo.cgi" METHOD="POST">
>             <INPUT TYPE="text" NAME="foobar" SIZE="50"><BR>
>             <INPUT TYPE="submit" VALUE="send">
>         </FORM>
>     </BODY>
> </HTML>
> 
> And then I used the form, and submitted the Hebrew name "Avraham" in Mozilla and
> Konqueror.
> 
> Result in Mozilla:
> foobar=%26%231488%3B%26%231489%3B%26%231512%3B%26%231492%3B%26%231501%3B
> 
> Result in Konqueror:
> foobar=%D7%90%D7%91%D7%A8%D7%94%D7%9D
> 
> So it is definitely *not* PHP which sends out the HTML entities, but Mozilla
> itself - as you can see, the cgi itself is pure bash.
> 
> Herouth

-- 
==========================================================
#                 Andre E. Bar'yudin                     #
#       Phone: (972)-54-882-026       ICQ: 48036924      #
#     Home page: http://www.cs.huji.ac.il/~baryudin/     #
==========================================================

Attachment: msg23412/pgp00000.pgp
Description: PGP signature

Reply via email to