I tested with my website in GTmetrix and it says
The following resources have a character set specified in a meta tag. Specifying a character set in a meta tag disables the lookahead downloader in IE8. To improve resource download parallelization, move the character set to the HTTP Content-Type response header.
Now it's like <meta http-equiv="Content-Type" content="text/html; charset=utf-8">.
How can I solve this problem? I am using HTML 5 and CSS3.
If your server is capable of running PHP, put the following code right at the top of your html file and rename it to whatever.php:
<?php
header('Content-Type: text/html; charset=utf-8');
?>
Related
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');
I use HTML5 meta tag for character encoding:
<meta charset="utf-8">
When I run pagespeed test, it gives me the following suggestion:
The following resources have a character set specified in a meta tag. Specifying a character set in a meta tag disables the lookahead downloader in IE8. To improve resource download parallelization, move the character set to the HTTP Content-Type response header.
under the Experimental rules menu. I know it does say that I'd better use PHP version and I do:
header('Content-Type: text/html; charset=utf-8');
But Should I completely remove the meta tag? But will not it force another issues for other browsers or devices?
Does anyone has an idea about this? Is the issue for only ie8 or is well-known code performance practice?
There's a blog post which from about a year ago, all credit to that, here you go.
http://diywpblog.com/avoid-a-character-set-in-the-meta-tag/
It suggests adding a rule in the .htaccess file that sets the default character encoding as UTF-8.
# pass the default character set
AddDefaultCharset utf-8
What is the difference between these two and should I use both ? I want my website to be fully UTF-8.
In PHP:
<?php
header("Content-Type: text/html; charset=utf-8");
?>
And the meta tag in HTML:
<meta charset="utf-8">
The HTTP Content-Type header should always be set, it's the primary source for the browser to figure out what kind of document it's dealing with. Only if this header is missing will the browser try to find an HTML meta tag which gives it the same information as a fallback.
It makes sense to set both flags though, since you may save the HTML document to disk, in which case the HTTP header will be gone for anyone needing it later.
You can find the exact rules for how a browser determines the document's charset here: http://www.w3.org/TR/html5/syntax.html#determining-the-character-encoding
header("Content-Type: text/html; charset=utf-8");
is server side and depends upon the PHP script calling it before it will send the new page to the client.
<meta charset="utf-8">
The meta element has two uses: either to emulate the use of an HTTP response header, or to embed additional metadata within the HTML document. So the Meta Tag is the best way to have utf-8 on your site.
I defined a webpage to use iso-8859-1 like the following:
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
But when I open the page in the browser, the browser is using UTF-8 to read the page. Why the browsers does not following the page charset?
If you have access to your apache config, you should look in the httpd.conf (or equivalent) for the following directive:
AddDefaultCharset UTF-8
According to apache docs, this will override the meta declaration that you set. http://httpd.apache.org/docs/2.0/mod/core.html#adddefaultcharset
You could turn it off by replacing the directive with this:
AddDefaultCharset Off
The information that really matters is the real Content-Type HTTP header sent by the web server. You can inspect it with Firebug of a similar tool. <meta> tags should only matter if you save the file to disk and the HTTP header is lost.
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.