Re: Displaying 'umlaut' character

From: Helmut Richter <hhr-m_at_web.de>
Date: Wed, 22 Sep 2010 10:16:01 +0200
Message-ID: <Pine.LNX.4.64.1009220955010.4549_at_lxhri01.lrz.lrz-muenchen.de>



On Wed, 22 Sep 2010, Jens Thoms Toerring wrote:

> And a web server normally
> sends a HTML header with the page that may contain a line
> like
>
> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
>
> That tells the browser which type of character set to use
> when displaying the page it got from the server.

Caution: A Web server sends an HTTP header (this is *not* a part of the text of the Web page, in particular, it has *not* the form of an HTML tag like <meta>) telling the MIME type, e.g. "text/html" and *optionally* containing a charset specification, e.g. "charset=utf-8". The Web page may *optionally* contain such a <meta> tag. The Web server is not obliged to send the HTTP header suggested in the <meta> tag, and most servers don't -- I am not sure any of them does.

In the special case that the page is generated by a CGI script, the output of the script contains *both* the HTTP header and the HTML text.

If there is a character code specified in the HTTP header, it takes precedence. If there is none, the one in the <meta> tag is honoured. Opinions are divided whether one should use the <meta> tag, as it has not always the intended effect, to wit when the server sends an HTTP header with a diverging code specification. I prefer using it for documentation and for those cases where there is no other code specification. More important than that it is present is that it is true if present -- if true, it does never any harm. All these specifications only describe what code is used in the content; they do not enforce the code.

Back to perl: Whatever your problem is (which is by no means obvious), you won't be able to understand it, let alone fix it, before knowing what is written in http://perldoc.perl.org/perlunitut.html.

-- 
Helmut Richter
Received on Wed Sep 22 2010 - 03:16:01 CDT

Original text of this message