Bad UTF-8 without BOM encoding
Asked Answered
O

4

5

I converted all my files to UTF-8 without BOM encoding using Notepad++. I have no problem with BOMs anymore but the UTF without BOM encoding is simply not working, it's as if my site was encoded in ANSI. All special characters display either as: Â, Ú or á.

What can be the reason for this and how can I fix it?

http://chusmix.com/?ciudad=Pilar

Thanks

Osiris answered 18/8, 2011 at 5:46 Comment(0)
X
6

You have to tell the browser to accept it as UTF-8 so it will properly parse multibyte characters. Add this meta tag in your <head> tag with the rest of your metas:

<meta http-equiv="content-type" content="text/html; charset=UTF-8" />

Update

For HTML5, use this tag instead:

<meta charset="utf-8">

Xanthe answered 18/8, 2011 at 5:50 Comment(2)
Add that to HTTP headers as well if all pages are utf8.Dorthadorthea
on a side note, if your file is encoded as UTF8 without BOM but happens to contain only charactes belonging to the ANSI set, some editors will open it in ANSI instead of UTF8.. so also check your editor's settings to avoid switching to ANSI without noticing..Credenza
B
4

you will need to tell your web server to tell the client that now everything is utf-8...

There are 2 options to do this:

  • HTTP header this is a setting of the web server itself Content-Type: text/html; charset=UTF-8

  • Meta tags this is something you could put into your html files header <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />

see http://www.w3.org/International/O-HTTP-charset.en.php?changelang=en

you can check your site for problems regarding charset and other things here

Brioche answered 18/8, 2011 at 5:53 Comment(0)
P
1

The HTML code doesn't contain any encoding, so the browser probably interprets it as ISO-LATIN, not UTF-8. Check out Setting the HTTP charset parameter at the W3 consortium.

Puttergill answered 18/8, 2011 at 5:52 Comment(2)
It's not really that the browser must interpret it as ISO-Latin, it just defaults to that encoding. This can be changed in the individual user agent.Sochor
@deceze: sorry, my sentence was ambiguous. I meant "it must be interpreting", as in "it probably is". Re-worded it to make it clearer.Sibyls
S
0

Send a header informing the browser what character set a document is encoded in:

header('Content-Type: text/html; charset=UTF-8');
Sochor answered 18/8, 2011 at 5:52 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.