open(IN,"<:encoding(utf-16le)","your_file.xml"); { local $/; $_ = ; } s/(xml version="1.0" encoding="utf)-16/$1-8/; # (that was cheating, but what the heck) # do whatever else needs to be done with the data # -- but use a real xml parser for that... then: binmode STDOUT, ":utf8"; # or whatever file handle you need to use print;