I'm trying to write a website in Slovak language (central Europe). What I have done is put these two meta tags into the header:
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-2" />
<meta http-equiv="Content-Language" content="sk" />
The problem is all characters with diacritique are substituted with garbage characters (so the encoding I not working obviously). What to do?
Here is the whole beginning of the page:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="sk" lang="sk">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-2" />
<meta http-equiv="Content-Style-Type" content="text/css" />
<meta http-equiv="Content-Language" content="sk" />
When you save the file you have to make sure that it's created with the same encoding that you have specified in the meta tag.
I recommend that you use utf-8 instead of iso-8859-2. The unicode character set supports all characters in practically every language that exists (and even some that don't...).
There are two issues at work here.
Language
The Content-Language HTTP header describes the natural language of the intended audience. This may not be the same as the language the document is actually written in. Use the lang attribute to describe that.
Character encoding
This allows you to represent the letters that you wish to use. You need to make sure that your text really does use the selected encoding and that the browser is informed that that is the encoding you are using.
HTTP headers
NB: Your question mentions <meta http-equiv>. Real HTTP headers are the better place to specify this information, and they will override whatever your document claims. Make sure your server is configured correctly.
XHTML
XHTML complicates matters…
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With