Re: Fix UTF Encoding issue

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

 



Tuesday 04 December 2007 10:28:59 Ismail Dönmez yazmıştı:
> Tuesday 04 December 2007 10:16:34 Martin Koegler yazmıştı:
> [...]
>
> > print t("#öäü");
> > print t("#ÀöÌ");
> > print "\n";
>
> How about this one, doesn't even use Encode, uses just built-in utf8
> function :
>
> [~]> cat test.pl
> binmode STDOUT, ':utf8';
>
> my $str = "#öäü";
>
> if (utf8::valid($str))
> {
>     utf8::decode($str);
> }
>
> print $str."\n";
>
> [~]> perl test.pl
> #öäü

Following to_utf8 function works for me :

sub to_utf8 {
·   my $str = shift;

    if(utf8::valid($str))
    {
        utf8::decode($str);
    }
·
    return $str;
}

Regards,
ismail

-- 
Never learn by your mistakes, if you do you may never dare to try again.
-
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux