IO::Scalar doesn't do binmode?

Do you have a question? Post it now! No Registration Necessary.  Now with pictures!

Threaded View

I was playing with Lingua::RU::Number, and noticed that it could only
output WINDOWS-1251 character set. Well, no problem, I think, I'll just
wrap it with IO::Scalar and let the encoding abstraction handle the
conversion to UTF8 for me.

So, I did this:

 perl -MLingua::RU::Number=rur_in_words -MIO::Scalar \
  -le '$win=rur_in_words(123);\
  $s=new IO::Scalar $win; \
  $s->binmode(":windows-1251");binmode(STDOUT,":utf8"); \
  print $s->getline()'

And got WINDOWS-1251 output again. Did I miss something, or is
IO::Scalar not supporting encoding conversion via binmode?

Re: IO::Scalar doesn't do binmode? writes:

Quoted text here. Click to load it

With 5.8.x, there's no need to use IO::Scalar. You can use open() on a
scalar variable (i.e. open($fh, "<", $variable)). I suppose that all
PerlIO is available in this case.


Slaven Rezic - slaven <at> rezic <dot> de
Tired of using file selectors? Real programmers use the TAB key for
completion and not for jumping around. Try

Site Timeline