in reply to Re: How to write a utf-8 file
in thread How to write a utf-8 file

Your code is correct.

Mostly. Since it adds literals to the string, it should also use utf8;, to avoid mixing of decoded and undecoded strings.

Replies are listed 'Best First'.
Re^3: How to write a utf-8 file
by ikegami (Patriarch) on Apr 13, 2011 at 07:33 UTC

    He should add use utf8; if and only if his source code is UTF-8.
    He should omit use utf8; if and only if his source code is iso-8859-1.

    There's absolutely no indication as to which is correct here, so I don't see how you can suggest one over the other.