Black Diamond charset=iso-8859-1 utf 8 issue - utf-8

I am still having issues with the black diamonds.
Take a look at this page: http://fpmnky.com/airport.php?airport_id=4131
The characters work great on the page, but in the search box type "LFLB" and you will see that the diamonds show up again.
This is in my header:
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
I also did a mysql_client_encoding() check and it said Latin1.
What else do I need to do?

Use
header("Content-Type: text/html; charset=iso-8859-1");
In the ajax response, or any response in general on your website.

Related

Hidden characters appear out of nowhere

I have an HTML Code that keeps coming up with hidden characters. At first, it was the A characters in all the extra spaces which I removed. I tried the <meta http-equiv ="Content-Type " and content= "text /html; charset=UTF-8" /> That seemed to fix the issue.
However, now the code comes up with hidden ?????. I have rebuilt the code again but once it's put through our system it comes up with hidden ?????, how do I fix this? Or could this just be that our system is messing it up?
Please see the photos for reference. <meta http-equiv="Content-Type" and content="text/html; charset=UTF-8=" /> seemed to fix the A character issue

How to Properly Define UTF-8 Charset in in <head> Tag Section of Web Document

If my doc type is <!DOCTYPE html> is it best or more correct to use
<meta charset="utf-8" />
or
<meta http-equiv="content-type" content="text/html;charset=utf-8" />
to define utf-8?
Thanks.
The first one is only valid with HTML5.
The second one is also valid for older (X)HTML versions
With this doctype (indicating HTML5) both are valid, I prefer the first as it is shorter. :)

character encoding of a framed document was not declared

I get this warning in FF when developing a site of mine. I can't find any real info about it and how to fix this.
the character encoding of a framed document was not declared. The document may appear different if viewed without the document framing it.
...e)});else for(var g in a)ca(g,a[g],c,e);return d.join("&").replace(bD,"+")}}),f....
jquery....min.js (line 4)
You need to put
<meta http-equiv="Content-type" content="text/html;charset=UTF-8">
In the head of the iframe or whatever charset encoding you are using.
In your case, it looks like you are serving a javascript file. In order to set the character encoding, you have to set it in the Content-Type HTTP header when serving the javascript file.
E.g:
Content-Type: application/javascript; charset=utf-8
However, if you are using an <iframe> element to reference javascript, then you are doing it wrong.
You should only use an <iframe> to display something, like HTML, text, SVG, PDF etc.
For an HTML document you can, inside the .html file, set the character encoding with a charset attribute on the <meta> tag and on a <script> tag. Note that the latter is deprecated and all modern browsers will read the <meta> tag of the document referencing the script.
Examples
iframed.html
<head>
<meta http-equiv="Content-type" content="text/html;charset=UTF-8">
<script src="jquery....min.js" charset="utf-8"></script>
<!-- note: setting charset on a <script> tag is deprecated -->
</head>
index.html
<body>
<iframe src="iframed.html">
</body>
If you have access to your web server, then you can set the character encoding as part of the response with Content-Type and you do not need to specify it in your documents.
HTML: Content-Type: text/html; charset=utf-8
JS: Content-Type: application/javascript; charset=utf-8
JSON: Content-Type: application/json; charset=utf-8
text: Content-Type: text/plain; charset=utf-8
In nodejs you use the setHeader method on the Response object.
response.setHeader ('Content-Type', 'text/html; charset=utf-8')
DevTools
You can use your browser's DevTools to inspect the network request and check the value of Content-Type header. See screen shot below.

UTF8 -- still showing weird characters?

My webpage's response headers show this:
Content-Type:text/html; charset=UTF-8
However, I still get a black diamond with white question mark for characters like é. What am I supposed to do exactly? It's my .htaccess that's setting UTF-8.
If its a script or HTML file, check the encoding of the file itself, which should be saved as UTF-8.
In Zend, its something like: Edit->Set encoding->Other: UTF-8,
If you are serving a HTML page you need to indicate in the HTML file that the content is UTF-8.
You can do this by adding a meta html tag to your header section:
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">

HTML unit displaying wrong characters

I'm using HTMLUnit. I am accessing the pages however special (Maltese) characters are being displayed wrongly. For example, ġuvni is displayed as ?uvni
HtmlPage page = submit_button.click();
System.out.println(page.asText());
I suspect it's an encoding problem, though I don't find any page.setPageEndoding or some similar method... Has anyone had such a problem before?
Thanks!
Make sure your page is in UTF-8 by putting this meta tag in your <head>:
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">

Resources