Your code works fine for me, but I'm in latin1 by default. You're getting unicode and I can reproduce it with use encoding 'utf8'; before the print. Try,
use encoding 'latin1';
print "Copyright " . chr(169) . " 2004 ...\n";
| [reply] [d/l] [select] |
That did it.
All these years and I've never come across this before. Is it the OS that is set up to use unicode? I imagine it must be a default system setting.
I notice that if I put the copyright symbol in comments or POD documentation it shows up as unicode, too, so I wonder how I might get it to work there. Any ideas?
It's just an annoyance, but it's nice knowing what's going on. Thanks for the tip about the encoding.
| [reply] |
Is it the OS that is set up to use unicode? I imagine it must be a default system setting.
It depends on the OS, and how your user environment is set up, and which perl version you're using -- e.g. on Redhat 9, the default user environment includes "utf8" as part of the locale setting, and perl 5.8.0 in that setup would treat the locale setting as the default encoding for all i/o. A lot of people got tripped up by that, so as of 5.8.1, perl doesn't behave that way anymore.
You just have to study the relevant details for your particular setup. The perlunicode and perllocale man pages you have there should help to figure out what's going on.
| [reply] |
| [reply] |
I got a warning a couple weeks ago from a friend who saw a wide character in the buffet line, but no, never any such warnings from Perl. Just the ugly output. Thanks for the link!
| [reply] |
printf "Copyright %c 2004\n", 169;
| [reply] [d/l] |
That seems to work only if there is a use encoding 'latin1'; line either before or after (!) the printf statement.
Thanks, though.
| [reply] [d/l] |