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


in reply to Re^3: JSON, UTF-8 and Filehandles
in thread JSON, UTF-8 and Filehandles

I'll have to do some more tinkering; I seem to remember running into some issues in my website's code where my JSON DB module was double-encoding text it writes to disk, even though no Unicode text was actually hard-coded into the file, but using utf8 made it do the right thing; it was getting all its data from other areas of the code. I was opening the filehandles in utf-8 binmode, getting mangled output and that's why I made the simpler test script just to see what was going on.

Edit: it seems you're right. :) I made a test script that opens a filehandle in UTF-8 mode, reads it and writes it to a different file in UTF-8 mode, without needing use utf8; in the source file.