http://www.perlmonks.org?node_id=647818

iman_saleh has asked for the wisdom of the Perl Monks concerning the following question:

Hello all, I wrote the following piece of code to convert a UTF-8 text into windows-1256 encoding. I don't know why the encoding of the output file is Unicode big endian. Please if anyone can help me with that tell me where is the problem.
#----------------------------------------------- use Unicode::UTF8simple; $uref = new Unicode::UTF8simple; open(IN, $ARGV[0]) or die; open(OUT, ">$ARGV[1]") or die; while(<IN>) { $string = $uref->fromUTF8("windows-1256",$_); print OUT $string; } close(IN); close(OUT); #-----------------------------------------------