in reply to WWW::Dict::Leo::Org encoding issue

I think the only way an editor could tell if a file was utf-8 and not ASCII "easily" was if it began with a byte order mark. Not needed or even recommended for utf-8 since it doesn't have a byte ordering, but editors on Windows like to see it. See the wikipedia entry.

Try adding this line after "binmode":

print OUT "\xEF\xBB\xBF";

Replies are listed 'Best First'.
Re^2: WWW::Dict::Leo::Org encoding issue
by ikegami (Patriarch) on Jun 14, 2010 at 17:53 UTC
    Previously mentioned
    open(my $fh, '>:utf8', $qfn) or die; print $fh "\x{FEFF}"; print $fh $text;
    is simpler than equivalent
    open(my $fh, '>:bytes', $qfn) or die; print $fh "\xEF\xBB\xBF"; binmode($fh, ':utf8'); print $fh $text;