http://qs321.pair.com?node_id=748893

DreamT has asked for the wisdom of the Perl Monks concerning the following question:

Hi!
I'm building a software with the usual three components:

- Perl source code
- A MySQL database
- HTML templates

All these components have their "own" character sets (Perl uses it's internal character set, MySQL uses it's own collation and the HTML templates have their character sets). Of course we're using the same character sets (currently latin1).

But, suppose that we do third party connections to other systems that uses other character sets, or the HTML templates "need" to have another character set. This can lead to consequences when POSTing data to the Perl source code, or when INSERTing data in the MySQL database.

One way is of course to convert the data when needed, but I'm looking for a way to handle "foreign" character sets in a more standardized way. So, my questions are:

- How do you handle this?
- Is it a good idea to convert incoming data to Perls internal format when processing it, and do vice versa when printing/storing processed data?
- Does the format of the file containing the Perl code itself matter?
_ I've looked att the Encoding::Guess module, is this an option to decide the format of the incoming data?
My concluding question: What is the best way to deal with different character sets in a system?