Will iso-8859-1 display German umlauts in order or do I need to use utf-8?

I have a multi-language site that is hosted on a server that apparently has the default character encoding iso-8859-1.

I thought that it would be best to have utf-8 pages and include a meta tag to declare it. Unfortunately, this meta tag seems to be overridden, and the default value is iso-8859.

Many special characters on German and Dutch pages do not display correctly.

Should I try to change the default utf-8 server or something like that? Maybe I can completely remove the default server? Hmm ... really not sure what the best thing to do here.

Any advice would be great!

+4
source share
3 answers

HTML meta tags for the content type are not used when the HTML page is transmitted over HTTP. Instead, the content type header in the HTTP response will be used. You can define a title for a content type, such as Firebug , in the Net panel.

alt text

How to change this depends on the programming language and / or web server that you are using, which is not clear from your current question. According to your background, you seem to be using PHP. In this case, you need to add the following line to the PHP file before you emit any character in the response.

header('Content-Type: text/html; charset=UTF-8'); 

See also:


If you cannot change the header of the HTTP response, you need to give more detailed information about the programming language and the web server that you are using. In this way, we can give you more suitable answers.

If you want to adhere to ISO-8859-1, you need to make sure that your pages are saved as ISO-8859-1 and not as UTF-8. Otherwise, some characters may indeed mojibake when displaying a saved UTF-8 resource as ISO-8859-1.

+6
source

There are several possible solutions, but the purest solution would be to correctly declare the character encoding of your character.

When serving web pages from an HTTP server, the encoding is usually not provided by HTML file meta tags, but by the Content-type HTTP header.

The web server is probably sending something like Content-type: text/html; charset=ISO-8859-1 Content-type: text/html; charset=ISO-8859-1 and you need to change it.

How to do this depends on the web server.

In addition: Yes, iso-8859-1 is great for German; he will work in all Western European languages. However, it lacks a few characters, especially the Euro sign (that is, in iso-8859-15). But it is better to use UTF-8, since it covers almost all languages.

+3
source

You can see the supported characters and languages ​​that should be covered in this Wikipedia article . According to this, German is fully supported, and Dutch is almost supported.

It is not just a matter of choosing the right character encoding, you also need to save pages using this encoding. If you save the page as ISO-8859-1 and use a content type that says it is UTF-8, then it will not be correctly decoded by the browser. Both ISO-8859-1 and Unicode support the characters you need, but you must make sure that the content type matches how the pages are actually stored.

0
source

Source: https://habr.com/ru/post/1334555/


All Articles