vkon has asked for the wisdom of the Perl Monks concerning the following question:
Following piece of code dies and I do not have my content in file "a.txt" (it has zero size):
Error message I get is: Wide character in syswrite at d:/perl5121/site/lib/File/Slurp.pm line 330. Notice the commented out Encode::_utf8_off($ustr); line.use utf8; use File::Slurp; use Encode; my $ustr = "simple unicode string \x{0434} indeed"; #Encode::_utf8_off($ustr); # ???? why do I need this? File::Slurp::write_file("a.txt", {binmode=>':utf8'}, $ustr);
If I uncomment this line, i.e. if I "reset" $ustr to be *not* utf8, all is good.
So, File::Slurp refuses to write scalar having UTF8, despite of fact that I specified {binmode=>':utf8'}, like manpage recommends
What I am doing wrong?
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: can not use utf8 with File::Slurp
by Corion (Patriarch) on Feb 15, 2011 at 15:57 UTC | |
by ikegami (Patriarch) on Feb 15, 2011 at 17:18 UTC | |
|
Re: can not use utf8 with File::Slurp
by mje (Curate) on Feb 15, 2011 at 16:22 UTC | |
|
Re: can not use utf8 with File::Slurp
by ikegami (Patriarch) on Feb 15, 2011 at 16:49 UTC | |
by vkon (Curate) on Feb 15, 2011 at 21:03 UTC | |
by ikegami (Patriarch) on Feb 15, 2011 at 21:17 UTC | |
by vkon (Curate) on Feb 15, 2011 at 21:44 UTC | |
by ikegami (Patriarch) on Feb 16, 2011 at 00:55 UTC | |
| |
|
Re: can not use utf8 with File::Slurp
by repellent (Priest) on Feb 19, 2011 at 00:14 UTC | |
by vkon (Curate) on Feb 19, 2011 at 07:56 UTC | |
|
Re: can not use utf8 with File::Slurp
by vkon (Curate) on Feb 15, 2011 at 16:46 UTC |