slugger415 has asked for the wisdom of the Perl Monks concerning the following question:
I have successfully used the Encode module to change the charset of HTML pages from iso-8859-1 to utf8, thusly:
if(!(is_utf8($html))){
from_to($html, "iso-8859-1", "utf8");
}
My question is, how do I determine the charset of an HTML page? If it's not iso-8859-1, I want to do something more like:
my($charset);
$charset = what_is_my_charset($html); # ok, I made that up
if(!(is_utf8($html))){
from_to($html, $charset, "utf8");
}
Any thoughts on how I'd do this? I've been looking Encode but haven't found what I'm seeking.
thanks,
Scott
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: How to determine HTML encoding
by ikegami (Patriarch) on Jun 30, 2010 at 00:31 UTC | |
by slugger415 (Monk) on Jun 30, 2010 at 18:23 UTC | |
by Corion (Patriarch) on Jun 30, 2010 at 18:45 UTC | |
by slugger415 (Monk) on Jun 30, 2010 at 23:36 UTC | |
by slugger415 (Monk) on Jun 30, 2010 at 23:50 UTC | |
by ikegami (Patriarch) on Jul 01, 2010 at 00:50 UTC | |
|