# http://tinyurl.com/7v67lnh I am working on a new page for a client. The character encoding I am using is utf 8:<?xml version="1.0" encoding="UTF-8"?> Also added a unicode BOM signature
. But somehow the Russian code in the right sidebar is mangled. Any ideas why?
use UTF-8 for your html page too, add this tag to your html code <meta http-equiv="content-type" content="text/html; charset=UTF-8"> upon your title tag
As mentioned in the comment to my question:
Solved it all by adding AddDefaultCharset UTF-8 to the .htaccess.
Apparently the server was going for another character encoding such as
Cyrillic or Windows. –
Related
I have an mvc solution with a standard view using _Layout page for layout. Layout page has charset=utf-8 set in the header like so:
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
For some reason, when I type "£" symbol in the view I get it displayed as "A£", with a dash above "A". At the same time when I put the same symbol in the _Layout page it's displaying fine. I got this resolved by using encoded value
£
but was wondering why does it happen?
It may have happened because of a mismatch between <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> and the encoding of your physical file.
E.g. Your file could be saved as ISO-8859-1.
I have read that note. I am using Adobe Dreamweaver for all my files and I think it is encoded in 'utf-8'.
Russian characters are shown correctly on the page but incorrectly displayed on the server side if send them from form. For example word игра transforms into игÑа. I have following lines in Config.groovy:
grails.views.gsp.encoding = "UTF-8"
grails.converters.encoding = "UTF-8"
And following line in the main layout view:
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
What should i do to fix it?
The data “игÑа” results from UTF-8 encoded “игра” when misinterpreted as ISO-8859-1. It sounds like the HTTP headers specify ISO-8859-1 (or some similar 8-bit encoding); this overrides any meta tags.
When converting HTML to a PDF document characters such as é or ñ are printed as question marks. How can I display them correctly in the PDF document?
Make sure you are setting the encoding on your HTML to UTF-8. It is probably trying to interpret it as US-ASCII
<meta http-equiv="Content-type" content="text/html; charset=utf-8" />
I am currently working on Classic ASP for one of my project. For non English languages I am getting boxes instead of special characters. I am rendering using UTF-8 but sometimes the characters goes to boxes. It comes back normal when I click refresh sometimes.
I followed all the steps below but i still get this problem
XML:
<xml version="1.0" encoding="UTF-8">
HTML:
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
content-type: text/html; charset=utf-8
Am I missing anything here? Thanks.
Add this to your page:
Response.CodePage = 65001
Response.CharSet = "utf-8"
It should display all correctly now.
Hope that helps
It's amazing BUT nobody gives a complete answer on what to do this PROPERLY... I hope this help somebody like me, because it was so hard to find the whole picture...
---------------- PREVIOUS CONSIDERATIONS --------------
FIRST, make sure IIS IS NOT replacing the Code Page... Go to IIS, click the Website, open ASP module, on Behavior it should be >> Code Page = 0
SECOND, The file itself should be checked, YES! the file... open your file explorer on windows (my computer), go to the folder where the files of your website are, take for example "default.asp", right click >> open with >> notepad THEN click on File >> Save As... IN THE DIALOG at the bottom says "Encoding", make sure it has UTF-8, otherwise you will have to add the
<meta http-equiv="content-type" content="text/html; charset=UTF-8"> in every page (including server side includes), which is not correct.
---------------- CORRECT STRUCTURE OF THE PAGE --------------
<%#LANGUAGE="VBSCRIPT" CODEPAGE="65001"%><%
Response.AddHeader "Content-Type", "text/html;charset=utf-8"
%><!-- #include virtual="/conexion.asp" -->
<!DOCTYPE html>
<html lang="es">
<head>
<meta charset="utf-8">
</head>
<body>
áéíóú
</body>
</html>
It should work fine now with QueryStrings, Database and regular HTML... uffff
In my Grails GSP file I'm using the HTML meta tag:
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
The problem is that Grails closes this tag and renders it as:
<meta content="text/html; charset=utf-8" http-equiv="Content-Type"/>
This fails W3C's HTML validation (since my doctype is HTML and not XHTML).
Is there a fix for this? How can I get Grails to not interpret the
meta tag?
I'm using grails-1.2-M4.
Follow up:
I create the Grails bug GRAILS-5696 for this issue.
Not sure that this is the most beautiful solution, but at least it will work for your case:
<%= '<meta http-equiv="Content-Type" content="text/html; charset=utf-8">' %>
Well...this does not work since it is preprocessed by Grails before displayed as is.
So the only solution I see is to create a TagLib and output the content like this:
class MetaTagLib {
static namespace = 'my'
def meta = {
out << "<meta http-equiv=\"Content-Type\" content=\"text/html; charset=UTF-8\"/>"
}
}
and use it like:
<my:meta />
It works. Tested.
You could validate as HTML5 instead of HTML 4.01, by using <!DOCTYPE html> (that's it, really!). HTML5 allows trailing slashes even in the HTML syntax, in order to allow for systems like this that produce pseudo-XHTML.
Of course, HTML5 is not yet a finished standard; it may change. I think that this aspect of it is unlikely to be changed, but there is still some fairly contentious debate about a lot of the new HTML5 features, so keep in mind that it's not yet finalized.