mohamad has asked for the wisdom of the Perl Monks concerning the following question:

Hi I Write a Script with Win32::Gui. I have problem for read from AddTextfield() with UTF8 character. I can Write in it , with UTF8 characters(I can Write with utf8 in AddLabel and ...) , but I need read from AddTextfield() in Win32::Gui.but when print it in IDE, Instead Of utf8 character unknow character showing for me. for example Instead Of محمد , this charachter printed :(ãÍãÏ).
my $name = $main->AddTextfield( -name => 'nametextfield', -pos=>[480,70], -size => [ 140, 25 ], -font => $font1, -align => 'right', -tabstop => 1, ); $text = $main->nametextfield->Text;
when I want insert text in database this error OCCUR ,(my column name is ,name and my database charachter set is utf8 collation utf8_persian_ci): --------------------------- DBD::mysql::st execute failed: Incorrect string value: '\xE3\xCD\xE3\xCF' for column 'name' at row 1 ------------------------- thankyou for help me.

Replies are listed 'Best First'.
Re: How read utf8 charachter from AddTextfield() in Win32::Gui
by Anonymous Monk on Apr 04, 2010 at 19:54 UTC
    unknown character showing for me.

    Where is it showing that (what program)?

    For example cmd.exe shows the output of

    perl -Mopen=:std,utf8 -e" print $_, ' ',chr($_), ' ' for 931 .. 935"
    as

    931 Σ 932 Τ 933 Υ 934 Φ 935 Χ

    But notepad will gladly show Sigma/Tau/Upsilon/Phi/Chi:

    931 Σ 932 Τ 933 Υ 934 Φ 935 Χ

    In both cases the bytes are the same

    $ perl -Mopen=:std,utf8 -e" print $_, ' ',chr($_), ' ' for 931 .. 935" + |hexdump 00000000: 39 33 31 20 CE A3 20 39 - 33 32 20 CE A4 20 39 33 |931 93 +2 93| 00000010: 33 20 CE A5 20 39 33 34 - 20 CE A6 20 39 33 35 20 |3 934 + 935 | 00000020: CE A7 20 - | | 00000023;
      main problem is in the , insert in databases. thankyou.