alexpgp: (St. Jerome w/ computer)
[personal profile] alexpgp
From 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:
use CGI;
$q = CGI->new;
instead of just sending a "standard" set of headers with:
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...

Profile

alexpgp: (Default)
alexpgp

January 2018

S M T W T F S
  1 2 3456
7 8910111213
14 15 16 17181920
21222324252627
28293031   

Most Popular Tags

Style Credit

Expand Cut Tags

No cut tags
Page generated Feb. 6th, 2026 12:53 pm
Powered by Dreamwidth Studios