On Mon, Apr 13, 2009 at 09:43, Dr.Ruud <rvtol+use...@isolution.nl> wrote:
> Kelly Jones wrote:
>>
>> I "cpan Text::Unidecode" on 2 machines and then ran this code:
>>
>> use utf8;
>> use Text::Unidecode;
>> print unidecode("\x{5317}\x{4EB0}")."\n";
>> print unidecode("\xd0\x90\xd0\xbb")."\n";
>> print unidecode("\xe3\x82\xa2")."\n";
>>
>> On both machines, the first line correctly prints "Bei Jing", the
>> author's test case.
>>
>> Second line: "Al" on one machine (correct), "DD>>" on the other.
>>
>> Third line: "a" on one machine (correct), "aC/" on the other.
>>
>> Thoughts?
>
> By putting in "use utf8;", you sign a contract that your source file is
> UTF-8 encoded. Why would you need that?
snip

That is the way the docs for Text::Unidecode tell you to do it. I thought
it was odd as well, but I assume they are thinking that you may have UTF-8
characters in your file if you are working with it.  There isn't anything
wrong with using the utf-8 pragma (unless your script is using a different
encoding), but I don't see much of a benefit either (since all of my code
is 7-bit clean).

-- 
Chas. Owens
wonkden.net
The most important skill a programmer can have is the ability to read.

-- 
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/


Reply via email to