Thomas 'PointedEars' Lahn пиÑал(а):
[...]
I can rely on correct charset only. Thanks for info.
^^^^^^^^^^^^^^^
You are welcome, but ISTM you have not understood yet.
Please trim your quotes next time.
http://www.safalra.com/special/googlegroupsreply/>
[...]
They will see the correct text if the declared encoding and the actual
encoding of the resource match. The encoding declared in the HTTP
header, not in the `meta' element.
not clear. How should look this 'right' encoding in html page?
It is the encoding used when storing the text content as a file.
Its better to show example with 'right' HTTP header and 'meta' element.
Try <URL:
http://pointedears.de/scripts/test/cyrillic2>
(It has been a while since I have learned Russian, so please bear with me..)
This is the source code used:
<?php
if (isset($_GET['correct']))
{
header('Content-Type: text/html; charset=UTF-8');
}
// Demonstrates what the wrong default encoding can do to a resource
else
{
header('Content-Type: text/html; charset=Windows-1251');
}
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN"
"
http://www.w3.org/TR/html4/strict.dtd">
<html lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Scripting Test Case: Encoding vs. Document Character Set</title>
<meta name="DCTERMS.created" content="2006-04-04">
<script type="text/javascript">
function foo()
{
alert("Понимаешь?");
}
</script>
<style type="text/css">
body {
background-color: white;
color: black;
}
div, p {
margin: 1em auto;
}
acronym {
border-bottom:1px dotted #999;
cursor: help;
}
</style>
</head>
<body>
<?php
if (!isset($_GET['correct']))
{
?>
<p>This <a href="
http://en.wikipedia.org/wiki/UTF-8"><acronym
title="8-bit Unicode Transformation Format">UTF-8</acronym></a>
encoded resource is served with the wrong encoding declaration in
the said:
<acronym title="HyperText Transfer Protocol"
HTTP</acronym></a> header (<tt>charset=<a href="
http://en.wikipedia.org/wiki/Windows-1251"
Windows-1251</a></tt>). That the included <a href="
http://www.w3.org/TR/html4/struct/global.html#edef-META"
<tt>meta</tt></a> element "declares" the correct encoding does
not matter; the HTTP header takes precedence.</p>
Document Character Set for <acronym
title="HyperText Markup Language">HTML</acronym> 4.01
documents said:
<acronym title="the Universal Character Set">UCS</acronym></a>,
so character references can be used in <a
href="
http://en.wikipedia.org/wiki/CDATA"><tt>CDATA</tt></a>
attribute values to represent non-<a
href="
http://en.wikipedia.org/wiki/ASCII"><acronym
title="American Standard Code for Information Interchange"
ASCII</acronym></a> characters:</p>
<?php
}
?>
<div><input type="button"
value="Выбери
меня!"
lang="ru"
onclick="foo();"></div>
<?php
if (!isset($_GET['correct']))
{
?>
Serve (almost) the same content with the correct encoding
declaration
(<tt>charset=UTF-8</tt>)</a></div>
<?php
}
?>
</body>
</html>
HTH
PointedEars
P.S.
I asked you to trim your quotes already (reduce it to the minimum necessary
to retain context, as you can observe in [my] other postings).