Hi again,
I'm having trouble when passing unicode strings via a html form text box. When I use the get method I can see that the unicode is being represented in utf-8 form, such that when I enter the word 'Bris' with a long r and a long s, the following is passed -
B%C9%BCi%C5%BF
the unicode for 'Bris' is - 'B' U+027c 'i' U+017f
'Bris' is entered into the text box called "Name". I now wish to see that the string 'Bris' was entered into the text box using the following code -
my $lr = chr(636);
my $ls = chr(383);
$str = 'B'.$lr.'i'.$ls,
if ($str eq param('Name')
{
...
but this comparison is always giving 0.
I also tried the following -
PrintUnicodeString($str),br;
PrintUnicodeString(param('Name'));
PrintUnicodeString
{
join("",
map {
printf("\\x{%04X}", $_) # \x{...}
} unpack("U*", $_[0])); # unpack Unicode characters
}
And this gives me the output -
0042 027C 0069 017F
0042 00C9 00BC 0069 00C5 00BF
What am I doing wrong?
Thanks.
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.