My website is replacing an apostrophe (') with a question mark (?) while rendering the page.
See the deal - my kitchen cook's at
www.dealschintu.com
It is a simple HTML page written by me which does the following
Connect to MySQL database
Retrieve title
Display
Add this between the <head> tags of your website:
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
It should do the trick.
I got it working by changing the php file encoding from utf-8 to iso-8859-1
Related
I am working on a friends website, he complained that he could not enter £ on his product pages, instead they were appearing as black square with ? in them (�)
I have been digging around in the code for 2 days now and am unable to find the culprit.
I have a MySQL DB with all the data in it. The DB and table/field are all set to: utf8_general_ci
Looking at a record in PHPMyAdmin, the record shoes £ as expected.
However, when looking at the front end, the £ displays as a black square with a question mark in side of it.
I read in multiple places that is due to the browser not knowing it is UTF-8 character so I checked and all pages contain the following in the tags:
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
The only way I can get it to display correctly is if I change the encoding via the browser to ISO-8859-1 or ammend the above meta tag to reflect the ISO-8859-1:
<meta http-equiv="content-type" content="text/html; charset=ISO-8859-1" />
Is anybody able to help me with what to try next?
Thanks for any help
Use this to the variable while output
$var = "£";
echo utf8_encode($var);
and make sure your
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
is in the header
I am having a strange issue. I have Swedish characters. My charset works fine when in loop and being pulled from mysql using PHP but when I simply enter HTML text Swedish character Å, Ä and Ö it does not work. Currently this is my set Charset:
<meta http-equiv="content-type" content="text/html" charset="ISO-8859-1">
Here is a picture of how it looks in the browser:
Now here is a picture of data being pulled from Mysql (in loop) on the same page:
If this question has been asked before, please direct me to the page. Could it be somethign to do with the actual page encoding?
You should try this:
<meta http-equiv="content-type" content="text/html" charset="UTF-8">
Probably the file itself ist stored in UTF-8.Try and save it as a ANSI file.
In notepad++ this can be done via Encoding > Encode in ANSI in the menubar.
Or try to change the meta tag as already suggested.
I have a website where the web pages feed from the same database and I found that in two webpages that have same queries they interpretate the spanish special characters differently.
I cant really figure out what is wrong as I have stripped out the code which is interpreting the special spanish characters wrong and building it up from the scratch.
This one interpretes the characters well.
http://amragl.com/
This one interpretes the characters wrong.
http://amragl.com/menu.php
They both have the following
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
They both feed from the same database and use same queries.
Does anyone have any idea of how to fix this problem?
Thanks in advance.
--UPDATE-
PEASE SEE THE WORD "GAZPACH" or "AL LIM" to see the difference.
You have both
<meta http-equiv="content-type" content="text/html; charset=UTF-8" />
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
in the same file.
I suggest only using the utf-8 one.
Change iso-8859-1 to utf-8, should fix it.
The menu.php page is rendering with windows-1252 encoding, even tho it has iso-8859-1 set.
Are the menu.php contents coming from a database? If yes, which encoding is the database using?
This question already has answers here:
Closed 10 years ago.
Possible Duplicate:
UTF-8 all the way through
I want submit text from text box in a form to a table in MYSQL which in turn show text in the post on website but there is a special quot ‘ in place of this ' which get converted into Â
Please tell how to submit data with simple text without showing these characters
I have already used
urldecode ( string $str ) , str_replace ()
Here is my code
$description = mysql_real_escape_string(htmlspecialchars(utf8_encode($_REQUEST['txtDescription'])));
You should call SQL code
SET NAMES utf8
before DML or SELECT.
Then make sure your HTML is utf8 encoded:
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
Today I found answer of my question by doing deep study on net
Strange special characters shown in my question are shown due to meta tags
so when we add UTF-8 meta then such type of characters are show so here is the solution
Replace below code on your webpage
<meta http-equiv="content-type" content="application/xhtml+xml; charset=UTF-8" />
with
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
Showing all code required to insert, retrieve and showing on webpage without showing any special characters
During submit of text to MYSQL table using query use below code
$description = $_REQUEST['txtDescription'];
$description = mysql_real_escape_string($description);
$description variable will be used in SQL insert query
During Retrieve and Showing of text from MYSQL table use below code
<?php print(str_replace("\n", "<br />", $row['tDescription']));?>
And also follow the 1 Answer above to show it properly
We are trying to add non-english chars to the site URL and inside text.
Currently php pages don't see Unicode 'get' arguments. The pages see the arguments as question marks, although we added <META http-equiv="Content-Type" content="text/html; charset=utf8">
See sample here.
Many thanks!
Output the strings trough utf8_encode();