Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl: the Markov chain saw
 
PerlMonks  

Re^4: JSON, UTF-8 and Filehandles

by Kirsle (Pilgrim)
on Aug 09, 2011 at 17:14 UTC ( #919508=note: print w/replies, xml ) Need Help??


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.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://919508]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others avoiding work at the Monastery: (5)
As of 2021-09-25 04:17 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found

    Notices?