Beefy Boxes and Bandwidth Generously Provided by pair Networks
Clear questions and runnable code
get the best and fastest answer

Re^2: any use of 'use locale'?

by wanradt (Scribe)
on Nov 20, 2009 at 13:36 UTC ( #808430=note: print w/replies, xml ) Need Help??

in reply to Re: any use of 'use locale'?
in thread any use of 'use locale'?

Thank you for suggestion! To be honest, i already did on sept 24th:

But it seemed to me that perlbug is buggy too, so i made bugreport about perlbug itself:

Cause i got no any kind of response at all, it seems to me, it was also useless... I did not find any trace of my reports and i don't see public register of perl bug-tickets. Could you point me, what am i missing?

Nnda, WK

Replies are listed 'Best First'.
Re^3: any use of 'use locale'? (source encoding)
by ikegami (Pope) on Nov 20, 2009 at 17:48 UTC

    #!/usr/bin/perl use locale; print uc("abc"), "\n";

    Wait a sec, and aren't found in iso-8859-1. The file you describe can't possibly exist. If the file is encoded using an encoding other than iso-8859-1, you need to tell Perl. use utf8; tells Perl that the source is encoded using UTF-8.

    That applies to the OP of this thread too, although it won't change the outcome.

    Useful commands:

    # Source is UTF-8 use utf8; # Appropriate de/encode data going through STDIN/OUT/ERR. use open ':std', ':locale';

      I am aware about utf8 in bugreport and in this case here. Cause "use utf8" makes more noise (adds warning "Wide character in print at...") and does not help, i let it out. So, in bug report i intentionally let "use utf8" out, cause my locale is UTF8. I find it being real bug, if i have utf8 locale and i say "use locale", perl does not follow this instruction in every possible way.

      Btw, i find that using "use utf8" is a waste of good thing, if we use it as "when in code is something in utf8". "use utf8" should say: in this pragma any, all and everything you even can imagine, is utf8. Or "use locale" should spread such message, if coder want to be dependent from locale

      Handling all kind of utf8 through lot of different things (open, use, locale, -C, binmode, special keys in regex) makes me always feel sick. Really. I am sorry, but through the 12 years i use Perl, i am just waited, when the unicode things settle down, being simple as that: "use utf8" and everything works. Or similar. Still i see hacks but no systematic solution.

      Yesterday, before posting, i searched last nodes about this topic, and i found this node: 801876. I just hope, that i really misunderstood the point, but if UTF-8 defines something being digit (\d) or word character (\w), then should it be like that in perl too...

      Nnda, WK

        adds warning "Wide character in print at..."

        You can't output characters to STDOUT without instructing Perl how to convert those characters into bytes. I provided the fix for that at the bottom of my previous post.

        So, in bug report i intentionally let "use utf8" out, cause my locale is UTF8.

        Your locale is not used to determine the encoding of the source file. You may see uc("abcõäöüšž") in your editor, but you told Perl uc("abcõäöüšž"). Check the length() of the string for fun...

        but if UTF-8 defines something being digit (\d) or word character (\w), then should it be like that in perl too...

        There are so many problems with your statement.

        • UTF-8 doesn't define anything of the sort.

        • Unicode does define digit and letter properties, but not what Perl allows in identifiers (\w).

        • Perl can match those two Unicode properties (and the other hundred) through \p.

        • Why should Perl only recognize Unicode. What about locales? You yourself want it to recognize locales. What about POSIX? What about what backwards compatibility? What about 99% of the people who use \d and \w to mean /[0-9]/ and /[a-zA-Z0-9_]/? Under Unicode, they would match much more.

        So yeah, Perl allows you to match the Unicode properties. It also allows you do other things too. Sorry, but you don't get to break just about every program that uses \d and \w.

Re^3: any use of 'use locale'? (Manual bug submission)
by ikegami (Pope) on Nov 20, 2009 at 17:37 UTC

    Yeah, I don't see the first. (Didn't look for the second.) When you use perlbug, it gives the option to "save to file". Then you can use your normal mailer to send the report.

    In other words, take what's on pastebin and send it to You get sent an automated confirmation message on receipt.

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://808430]
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others scrutinizing the Monastery: (4)
As of 2018-05-25 19:20 GMT
Find Nodes?
    Voting Booth?