Mailing List Archive


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[tlug] utf form problems



Hi

I'm trying to get my first form using UTF working and am
having problems.

my html header looks like:
<head>
<title>Heisig Info</title>
<meta name="Generator" content="Vim/7.0">
<meta http-equiv="content-type" content="text/html;
charset=UTF-8">
</head>

According to what I've found on the web, the content
statement should be all I need to do to enable UTF-8 encoding.

The input on the form looks like:
<input type="hidden" name="rtk_kanji_1" value="助">

I'm using perl 5.8.8 and have a script for debugging.  I'm
trying to use HTML::Entities to decode the input.  I'm using
a POST method form.

I'm pretty sure the form is the problem.  It looks like the
encoded string being sent to the server is wrong.

I have a debug statement to test how utf-8 works on the
server.  It does nothing but encode/decode a utf-8 string.
That segment of code looks like:
   my $x = "rtk_kanji_1=助";
   print "\$x=\"$x\"\n";
   my $y = encode_entities($x);
   print "\$y=\"$y\"\n";
   my $z = decode_entities($y);
   print "\$z=\"$z\"\n";
and output from this debug in the browser looks like:
    $x="rtk_kanji_1=助"
    $y="rtk_kanji_1=&#x52A9;"
    $z="rtk_kanji_1=助"
so I'm pretty sure things on the server side are ok.

I have debug statements to look at what is arriving on stdin
at the server that look like:
if ($input) {
    my $output = decode_entities($input);
    print "\$input = \"$input\"\n";
    print "\$output = \"$output\"\n";
}
and the debug output in the browser looks like:
    $input = "rtk_kanji_1=%E5%8A%A9"
    $output = "rtk_kanji_1=%E5%8A%A9"
so decode_entities isn't doing anything with the string and
to me the encoded string doesn't look like what I expected
for an encoded utf-8 string.

What am I missing.  From what I've been able to find on the
web, this shouldn't be difficult, but I don't quite know
where to go from here.

Thanks
Steve S.



Home | Main Index | Thread Index

Home Page Mailing List Linux and Japan TLUG Members Links