IO::Scalar doesn"t do binmode?
am 23.09.2005 21:28:47 von AaronJSherman
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?
am 25.09.2005 10:33:32 von Slaven Rezic
AaronJSherman@gmail.com writes:
> 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?
>
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.
Regards,
Slaven
--
Slaven Rezic - slaven rezic de
Tired of using file selectors? Real programmers use the TAB key for
completion and not for jumping around. Try
http://search.cpan.org/search?mode=module&query=Tk::PathEntr y