open( IN, "<:UTF-16LE", "file.in" ); open( OUT ">:utf8", "file.out" ); while () { s/=/key1/; # using utf8 internally makes this easy print ; }