This file is in UTF-8 already with:
<head>
<meta charset="UTF-8">
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
in the top but the word CAFÉ gets displayed as the following:
the HTML is:
<html>
<head>
<meta charset="UTF-8">
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title> form... </title>
</head>
<body>
CAFÉ
...
</body>
</html>
How do I fix it?
The document is in fact interpreted as windows-1252 encoded. The UTF-8 form of “É” consists of the two bytes 0xC3 0x89. Interpreted as windows-1252, they denote “Ô and “‰”.
The most probable cause is that the HTTP headers sent by the server specify windows-1252 as the encoding (or iso-8859-1, which actually means the same thing). This information overrides any meta tags in the document itself.
Related
I have problem with the special character (question mark) was shown to my content
All the suggestions I already use but still the question mark is showing.
Blade::setEchoFormat('e(utf8_encode(%s))');
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<meta charset="utf-8">
Sample text have question mark sign
$footersign = "©";
<div class="footer-copyright text-center py-3">{!! $footersign !!} <?php echo date("Y"); ?>
Hi-Flyer Food. Designed by Solutions Experts and Enablers, Inc.
</div>
Sample Image:
please change
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
to
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
because utf-8 can represent all characters hving iso-8859-1 also, try html entity name or number like
$footersign = "©"; or $footersign = "©";
instead of
$footersign = "©";
check your php file is encoded UTF-8 without BOM
I have a strange situation.
I am specifying utf-8 in the meta data of my html file:
<!DOCTYPE html>
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width" />
....
</head>
<body>
<? include("extras.php"); ?>
</body>
</html>
but my speacial characters "ä, ö, å" are being display incorrectly.
Even more strange through is that the same characters used int the included file (hard coded no loaded from php), are being displayed correctly?
can anyone enlighten me as to why this might be?
Encode the special characters, for example, the letter ä you should encode as ä
You can use an HTML encoder/decoder (there are many available online):
http://www.opinionatedgeek.com/DotNet/Tools/HTMLEncode/encode.aspx
or do it programmatically.
This question already has answers here:
UTF-8 all the way through
(13 answers)
Closed 7 years ago.
MySql database uses utf-8 encoding and data are stored correctly.I use set_name utf8 query to make sure the data called are utf-8 encoded.all variables from database works fine as long as the header charset is utf-8,but the static html characters do not work properly.When i set header charset to ISO-8859-9 variables are displayed differenly while html characters work ok.can anyone help me?
Utf8 encoding: http://oi48.tinypic.com/289kje1.jpg html tags have problem displaying values.but php data(green ones e.g. ağişler) that come from database is ok.ISO encoding http://oi50.tinypic.com/287n2ph.jpg this time the html is ok but php data are displayed wrong.
<?php
header('Content-Type: text/html; charset=ISO-8859-9');
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><title>noname</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
You can try explicitly adding content type at the top of your file as below
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
and remove the below from your code..
header('Content-Type: text/html; charset=ISO-8859-9');
Update:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
</head>
<body>
<?php echo "for example Ş and İ "; ?>
</body>
</html>
The above code gives me the below output:
So data from the database works if you tell the browser to interpret it as UTF-8, that means that data is UTF-8 encoded. The HTML code works if you tell the browser to interpret it as ISO-8859, that means the HTML is encoded in ISO-8859.
So you have a document with mixed encodings. Bring those two together. Save your source code files as UTF-8 and tell the browser to interpret it as UTF-8, or get your data from the database in ISO-8859 and tell the browser to interpret it thusly.
I'm trying to print a string, like this:
Noticias de Fútbol.
But when I print this string, it displays like this:
Noticias de F�tbol.
I tried htmlspecialchar() and many more, but my output remains the same.
$str = "Noticias de Fútbol";
$strfoot = html_entity_decode($str);
How can I resolve this?
You don't need to use html_entity_decode, you can just simply print out your $str with echo, but you have to make sure your html has this line of code in the <head>:
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
You have use charset utf 8 and htmlentities function of php
Like
<meta http-equiv="content-type" content="text/html; charset=utf-8">
$test=htmlentities("Sisälämpötila");
echo $test;
You are most likely outputting to a page that has the wrong charset specified. To confirm this open a JavaScript console and evaluate window.document.charSet and window.document.characterSet.
If that is the case you can use a meta tag to inform the browser of your intended charset:
<meta content="text/html; charset=utf-8">
I'm reading elsewhere the tag might be:
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
Your php file is not utf-8 but the browser is reading it as utf-8 which is giving you that question mark character. Save your file as utf-8, most editors/ides have options to set the charset of the file.
I have written some croatian language in my page.But when i m seeing result some unsupported text is not coming on browser.This is replacing "?" there.what i have to do ?
I suggest using UTF-8 character encoding.
You should also convert your HTML files to UTF-8 character set (without BOM). You can do this using Notepad++ for example.
I have tested the following code and it is working:
<html>
<head>
<title>title</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
</head>
<body>
vaše
</body>
</html>
Add encoding to your page, depending on what encoding you used to create your page, you need to add the following:
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
Or it's HTML5 equivalant
<meta charset="utf-8" />