Solving the code page riddle...
Dec. 11th, 2013 08:18 amFrom the w3.org Web site, I learned that, although character encoding can be declared "inside" of HTML text (either as a meta charset attribute in HTML5 or in a pragma directive in HTML 4.01, which is what I have been doing and relying upon) it can—and apparently should—also be specified inside the so-called "HTTP header," which is an animal I had not paid much attention to before.
(These headers are what arrives from a server before the part that ends up rendered in a browser, between the <html> and </html> tags.)
This basically means that in my Perl script, after declaring my use of the CGI module and creating a CGI object to work with:
And it works! Chrome auto-detects the right encoding if it is specified in the HTTP header information!
A small victory, but I think life is made up of small victories.
Cheers...
(These headers are what arrives from a server before the part that ends up rendered in a browser, between the <html> and </html> tags.)
This basically means that in my Perl script, after declaring my use of the CGI module and creating a CGI object to work with:
use CGI;instead of just sending a "standard" set of headers with:
$q = CGI->new;
print $q->header;I should specify character encoding with:
print $q->header('text/html; charset=utf-8');So I tried this out, getting rid of the declarations inside the HTML output.
And it works! Chrome auto-detects the right encoding if it is specified in the HTTP header information!
A small victory, but I think life is made up of small victories.
Cheers...