When I type Korean in my html code and open it through my browser, Korean is not recognized by the browser and prints some weird words. What shall I do?
There must be few mistakes you are making.
First, You should have a doctype specified on your HTML page. Use HTML5 doctype
<!DOCTYPE html>
Second, you should specify the character encoding of the document as well. So, add:
<meta charset="utf-8" />
In your head section. Or for a longer version with better cross browser compatibility use:
<meta http-equiv='Content-Type' content='text/html; charset=utf-8'>
Also as Juhana said, your file must be saved with same encoding (i.e. Unicode UTF-8) to be able to store Unicode characters and display them.
Related
I have used the following code in my head tag.
<!DOCTYPE HTML>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Admin Panel</title>
</head>
I have characters of other language which is supported by UTF-8 encoding in my web page. But when i save my html file it showed me error The document's current encoding can not correctly save all of the characters within the document. You may want to change to UTF-8 or an encoding that supports the special characters in this document.
I have already using UTF-8. How to fix this?
You are not using UTF-8. You have just included some markup which tells the browser you are using UTF-8.
That error message sounds like it is coming from your editor. You need to configure your editor to save in UTF-8.
I just validated an HTML document using the W3C validator, and found that if I use:
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
with:
<!DOCTYPE HTML>
It throws a warning Line 4, Column 72: Using windows-1252 instead of the declared encoding iso-8859-1.
However, it is fixed if I use:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
I don't really understand what is happening. Also, I don't even know how to use the DOCTYPE tag, I just copied and pasted one from around the web.
Why does this happen?
How should I use the DOCTYPE tag?
Changing the DOCTYPE is simply turning off the warning - it isn't actually fixing anything.
iso-8859-1 and windows-1252 are very similar encodings. They differ only in the characters associated with the 32 byte values from 0x80 to 0x9F, which in iso-8859-1 are mapped to control characters and in windows-1252 are mapped to some useful characters such as the Euro symbol.
The control characters are useless in HTML, and web authors often mistakenly declare iso-8859-1 and yet use one or more of those 32 values as if they were using windows-1252, so browsers when they see the iso-8859-1 charset being declared will automatically change this to be windows-1252.
The validator is simply warning you that this will happen. If you're not using any of the 32 byte values, then you can simply ignore the warning - it's not an error. If you are, and you genuinely want the iso-8859-1 interpretation of the byte values and not the windows-1252 interpretation, you are doing something wrong.
Again, this switching happens in browsers for any DOCTYPE, it's just that the HTML5 validator is being more helpful about what it is telling you than the HTML4 validator is.
A couple of points:
Any HTML5 validation should be taken with a grain of salt. The specification is still under active development, and not everything is set in stone.
You're using the HTML4 syntax for that meta tag. Try <meta charset="iso-8859-1">
That said, HTML validators don't serve that much purpose in this day and age.
But apparently the default for HTML4 was iso=8869-1. That said, the default charset for HTML5 is UTF-8.
More information about the HTML5 doctype can be found in this post by John Resig.
It throws a warning Line 4, Column 72: Using windows-1252 instead of the declared encoding iso-8859-1.
It means the file was saved with the encoding Windows-1252 on creation (AKA Western Windows 1252 or CP1252) and your charset declaration says "hey read this file with ISO 8859-1" when that's not the encoding the file has.
The meta charset exist for that reason. It exist to declare the encoding of the file you are sending/reading/using so when, for example a browser, reads the document it knows what encoding the file is using.
In detail, you have this charset declared:
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
But the file you are validating is actually encoded in Windows-1252. How? Why? Check the text editor you are using and what encoding it is using to save files. If the editor can be configured to change the encoding, choose the one you want to use.
About HTML5
Using
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
or
<meta charset="iso-8859-1">
are both valid for HTML5. See <meta charset="utf-8"> vs <meta http-equiv="Content-Type">
The W3C validator offers options for which encoding the validator uses. You have specified encoding in your document, so you should see "Encoding: iso-8859-1" in the top block of information once the validator has been run.
To the right of that, there is a pull-down menu. Change the choice from "(detect automatically)" to "iso-8859-1 (Western European)". The validator will then use ISO 8859-1 instead of its own choice, and you will not receive the error.
Do the following:
ISO 8859-15. Yeah, -15, and it will work.
Don't place too much stock in the validators. There are typically too many Internet Explorer workarounds, particularly in the CSS content, that will trip up the validator. If your pages work in all browsers and your client is happy, it doesn't matter what some validator says.
If you are specifying the HTML5 doctype, then you should be consistent with the meta charset attribute. Try this though for your pages:
<!DOCTYPE HTML>
<html>
<head>
<meta charset="UTF-8">
</head>
<body>
</body>
</html>
I have a Unicode problem... I´ve done this before but for now, I cannot understand
why the Icelandic letters don´t show up - I have those question marks again
Here is the url (very plain and short html5)
http://nicejob.is/new/
Everything I Google says: use the <meta charset="utf-8"> as I do.
Any suggestions?
Your page is already viewed as UTF-8. But your source code is not saved as UTF-8.
Please change the encoding of your source code file to UTF-8.
Not all browsers support HTML5-way tags yet
here you can see table of compability
Try this instead:
<meta http-equiv="Content-Type" content="text/html;charset=utf-8">
I can see a couple of issues.
The META should look like this:
<meta http-equiv="content-type" content="text/html;charset=utf-8" />
The <html> specified lang="en" which might be prone to confusing some browsers.
When I view the HTML from the browser, the question marks are encoded as 0xEF 0xBF 0xBD, which is the UTF-8 encoding for the byte order mark or BOM, aka U+FEFF. So, for whatever reason, the HTML is not transmitted as sensible UTF-8 (though it does seem to be valid UTF-8).
Probably you are using some text editor like notepad++,
and you didn't set up encoding to UTF-8 in that text editor.
What you have to do is to save the file with utf-8 encoding by using Notepad (the attached one with Windows).
Steps:
Save as ..
In the below options ... you will find encoding option choose UTF-8 ...
And save the file ...
Then add the line <meta charset="UTF-8" /> inside your file ...
And it will work.
i like the new doctype that is being used
<!DOCTYPE html>
and the utf-8 which is
<meta charset="utf-8">
what are a few others that is being used under html5 based on your experiences?
also wondering if this new doctype html takes care of any doctype does it just guess what is being used?
also how and when do i use another charset rather than utf-8 ? thanks
The doctype works because browsers don't actually care what doctype you use and never followed the URL, they just check that the document specifies at least so that they don't render in quirks mode. If you're using the XHTML5 serialisation then you can provide a URL as you used to, though you're unlikely to use XHTML5 in the real world.
You probably don't want to create new pages in anything but utf8, if you do have data that is encoded separately and you can't/won't convert it into utf8 then you can specify a different encoding with <meta charset="charsetname"> where charsetname is an alias or name registered with IANA
The spec lists some meta tags that you can use. Basically the main one is still <meta name="description" value="This page is about foo">
the page in question is Apple Amor
You can see that in the footer the spanish vowels seem to be showing properly , but in the slide down bar(header) they get messed up.
Any ideas why ?
Your page is encoded in ISO-8859-1. Wherever that header comes from, it is most likely encoded in UTF-8.
You would have to change the character set of your page to UTF-8 (that would probably have some consequences) or convert the incoming data from the header. I don't know where it's coming from, so it's hard to tell what the right method would be.
Mandatory basic reading on the issue: The Absolute Minimum Every Software Developer Absolutely, Positively Must Know About Unicode and Character Sets (No Excuses!)
Your page source shows that you're using:
<meta http-equiv=Content-Type content="text/html; charset=iso-8859-1">
Note that the above tag is not well formed. Where is its closing character "/"? Content-Type should be between double quotes.
Add this tag to your page and test:
<html lang="es">
If that doesn't solve your problem try to change the charset tag to:
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />