Beefy Boxes and Bandwidth Generously Provided by pair Networks
No such thing as a small change

Re: Polish Characters

by zby (Vicar)
on May 21, 2010 at 10:13 UTC ( #841067=note: print w/replies, xml ) Need Help??

in reply to Polish Characters

Hi there, You posted that to the mailing list and I answered you there - did you not receive my email? Maybe the list server is not working correctly. Anyway here is the example that I typed for you:
use utf8; binmode(STDOUT, ":utf8"); my $string = "azsc"; while( $string =~ /(\w)/g ){ print $1; } print "\n"; __OUTPUT__ azsc
Replace the 'azsc' with utf8 encoded characters - and it should work, unfortunately PerlMonks mangles the characters when I try to input them here. This does not depend on the locale - but instead it is using the character semantic, it think this is the more modern approach. The important point is that your data needs to be correctly decoded into the characters. Here I used the utf8 pragma so I could put the characters into the program text, but if you read the data from outside sources you need to decode it - this is covered in multiple online sources for example:
open(my $fh, "<:encoding(UTF-8)", "filename") || die "can't open UTF-8 encoded filename: $!";
this snipped is part of the documentation for the 'open' Perl function.

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://841067]
[LanX]: oh .bat you mean?
[LanX]: obscure cult ...
[Corion]: LanX: cmd.exe is just another way to launch Perl
[LanX]: I know its a cult... and I repent it every time
[LanX]: But cygwin comes with path problems and powershell requires too much learning for me
[LanX]: eshell in emacs is often my resort in development
[LanX]: Thx found a solution! :)

How do I use this? | Other CB clients
Other Users?
Others perusing the Monastery: (9)
As of 2017-03-27 16:00 GMT
Find Nodes?
    Voting Booth?
    Should Pluto Get Its Planethood Back?

    Results (320 votes). Check out past polls.