Use umlauts in UTF-8 coded HTML-files with firefox - html

<h1>Wörterbuch</h1>
This is a very simple (generated by Zotero) html file and it is UTF-8 coded.
But firefox is not able to handle it correct.
When viewing the source of the opened html file in firefox it looks like that.
<h1>Wörterbuch</h1>
My last touch of HTML is from the beginning of the 90's. This file is UTF-8 so firefox should know itself how to handle the ö their. But it doesn't so I need something in the header, right?
What information does firefox need here?
This work well with Opera.

Make sure your HTTP server is sending the correct HTTP header to identify the encoding of the document:
Content-Type: text/html; charset=utf-8
As a fallback, add the <meta> tag to the document's <head>:
<meta charset="utf-8">

Related

Microsoft Edge does not recognize content-type html

The following html is not recognised by MS Edge(Windows 10) and it downloads html as a file instead of rendering. It renders as html in Chrome and FireFox without any issues. The error is repeatable on other machines and IE 10
<!DOCTYPE HTML>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
The problem is not with the file content, but with HTTP headers. You have to make sure that server sends proper Content-Type header, for example:
Content-Type: text/html; charset=iso-8859-1
Aaargh, I found the problem: The html that was downloading came from a .php file which included a PHP directive:
header('Content-Type: charset=ISO-8859-1');
This was overriding the content-type setting in default header html which was then downloaded as text as displayed in my original question above. This then made me think it was a MS Edge issue when in reality FireFox and Chrome must assume HTML as default content-type but Edge clearly does not. Anyhow, this change in php directive fixed the issue:
header('Content-Type: text/html; charset=ISO-8859-1');

html looks weird in outlook, but ok in browser

I'm doing mailings, which contains html code.
If I check my HTML in IE or FF, everything looks great. But when I sent the mail, the characters become very weird:
In browser: Information générale
,In E-mail : Information g�n�rale
My HTML meta: <meta http-equiv="content-type" content="text/html; charset=UTF-8">
Clearly this has something to do with the encoding, but I don't get why it looks OK in a browser and not in the email...
I have other HTML emails (newsletters received from other persons) which use the same HTML meta, and those emails look just fine..
� is an indication that the browser/E-Mail client uses UTF-8 to render the document, but encountered an invalid character from a different encoding.
It isn't enough to set the content-type meta tag; your data actually needs to match the encoding you're declaring.
If it comes from a file, make sure the file is encoded as UTF-8 (usually, the editor will offer you a setting in the "Save as...." dialog.)
If it comes from a database, see UTF-8 all the way through
In the email you have one more place to add an encoding:
- The mail header
- the mine header
- if content is text/HTML in the HTML header
All of these need to be set right.
Sorry for short answer. Writing this on my cellphone.

Greek fonts issue

So this is my page: http://www.mysecretathens.gr/kulte_test/coming_soon.html and the greek fonts wont display, why is that?
I use Open Sans, greek script and I've put an html iso tag in the beginning, but still no Greek characters.
<html lang="el">
You are not telling your page to use UTF-8. The best way is to send an HTTP header.
Content-Type: text/html; charset=utf-8
The alternative is to let the webpage say what its encoding is
<meta charset='utf-8'>
Note that Chrome correctly guesses it. The first way is preferred since it keeps your application more DRY since you already have to choose an encoding on the server.

Webview doesnt show Æ Ø Å properly

I have some content on a webpage which contains æ ø å, but my webview cant show them properly.
Does anyone know what the problem might be ?
In order to use UTF-8 characters inside an (X)HTML page you declare the encoding with this meta tag (in the head section of the page):
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
If that alone does not work you may be able to find more useful information here.
You need to ensure that the HTML file is saved as UTF-8 and that the Content-Type header in the HTTP response contains the proper charset. You can verify the headers by among others Firebug.
A <meta> tag for Content-Type would only work when the Content-Type header in the response is absent and this is usually not the case when the HTML file is served over HTTP. However, its presence is good for offline viewing and self-documentary purposes.

accented letters are not displayed correctly on the server, even if the encoding is correct

i wrote some html with utf-8 charset.
in the head of the html there is also a
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
everything works fine in local, but when i upload files to the server, i see all my letters
àèìòù etc
distorted.
anybody know how could it be the problem? is possible that the server force a charset that isn't utf-8?
thanks a lot
Try saving the actual file with utf-8 encoding. That did the trick for me.
I use PHPStorm as editor: File->File Encoding->utf-8
Actually the META tag is not all you need for correct UTF-8 encoding. Your server might still send the page as Content-Type: text/html; charset=ISO-8859-1 in the header of the page.
You can check the headers e.g. with the Live HTTP Headers Firefox add-on.
There is a lot of secret sauce with UTF-8 encoding and making it work, you might want to go through this page (UTF-8: The Secret of Character Encoding) which explains everything you need to know and gives you advice on how to solve encoding problems.
To answer your question: Yes it is possible to force the server to use UTF-8, e.g. by using the PHP headers() function like so:
header('Content-Type:text/html; charset=UTF-8');