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?
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?
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: How to handle encodings?
by moritz (Cardinal) on Mar 06, 2009 at 15:46 UTC | |
by bibliophile (Prior) on Mar 06, 2009 at 21:10 UTC | |
by moritz (Cardinal) on Mar 07, 2009 at 11:21 UTC | |
by graff (Chancellor) on Mar 07, 2009 at 17:26 UTC | |
by clinton (Priest) on Mar 07, 2009 at 19:06 UTC | |
by Narveson (Chaplain) on Mar 07, 2009 at 22:28 UTC | |
Re: How to handle encodings?
by webshop (Acolyte) on Mar 09, 2009 at 10:39 UTC | |
by DreamT (Pilgrim) on Mar 17, 2009 at 16:08 UTC |
Back to
Seekers of Perl Wisdom