8 ms·
"every time you call a library or do IO you have to manually deal with conversions.." (from the blog post) This is certainly not true for libraries; Only done
by gizzlon 15y ago
"every time you call a library or do IO you have to manually deal with conversions.." (from the blog post)
This is certainly not true for libraries; Only done that to workaround faults in other "systems"[1].
For IO, you don't have to "manually deal with conversion". But you do have to, if you want to do it correctly, tell it what encodings the files you're going to read are. But you do this once for all IO.
There's a reason for this, and it has nothing to do with the language: You can't detect encodings. So, you either standardize on one encoding to rule them all or supply it when doing IO. To be honest, I seldom do it the "correct" way, and it works fine most of the time.
[1] E.g., the DB table had one encoding, but the data was actually stored using another one.
Edit: Just for the record, dealing with this can be a pain in Perl. Keeping things backwards-compatible means everything is not as streamlined as it could be. But at least it works (I'm looking at you PHP ;)