Beefy Boxes and Bandwidth Generously Provided by pair Networks
Think about Loose Coupling
 
PerlMonks  

Re: utf8 forever OR what are the best practices ...?

by kroach (Pilgrim)
on Dec 19, 2018 at 10:06 UTC ( #1227450=note: print w/replies, xml ) Need Help??


in reply to utf8 forever OR what are the best practices ...?

I believe the best practice is still doing it on case-by-case basis, at least when dealing with external data, since you never know what you'll get. Utf8 might be widespread but it's not like the other encodings are not used. As for automatic support, I guess this is as far as you can really go:
use utf8; use open ':encoding(UTF-8)';
This will allow you to write unicode strings into the source and automatically handle encoding/decoding on read/write in new filehandles. Mind that if you read data from databases, external APIs or whatever other source that is not a filehandle, you will still need to set the specific options or decode it yourself, it will all the depend on the library used. Unfortunately, there is no one magic setting which will set everything to utf8.

Replies are listed 'Best First'.
Re^2: utf8 forever OR what are the best practices ...?
by pcouderc (Monk) on Dec 19, 2018 at 11:00 UTC
    1- I think that "use utf8::all;" does the job... with limitations.
    2- I would be so sorry you be right.
    I want a world with no more encoding. And at least a word where by default I have not to care with encoding. I hate encoding... This is a concept of previous millenary, like writing numbers in octal...
    And all my files and databases are utf8. And yes, I want magic...

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others browsing the Monastery: (5)
As of 2020-10-23 12:07 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    My favourite web site is:












    Results (238 votes). Check out past polls.

    Notices?