Two webpages displaying differently special spanish characters - php

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?

Related

UTF-8 Special Characters in PHP/Codeigniter not displaying correctly

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

special characters replaced by question mark

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

Html Special Chars PHP

fm API to get event discription, venue name etc...
Now sometimes I get special chars back like: ' é à , but they show up scrabled.
So how can I display them properly? Also with the descrioption I get html-tags back, but I do want to keep these.
Can someone help me out fot those both cases? The language I'm using is php
Thanks in advance
specify encoding in the header:
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
...
encode string when handling the input
$str=utf8_encode($str);
if you are displaying the input back as-is, no encoding is required;
however, if the value is the content of an input or textarea, escape the html characters
<?php echo htmlspecialchars($str); ?>
For Latin characters, use
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
in your section.
you need to be sure about two things, the meta header referring to which enconding you will be using, and the encoding you are using for the text served.
If you are using a utf8 header just be sure to convert the text served to utf8, refer to functions for encoding conversion like : mb_convert_encoding

trouble with non-latin characters

I'm having some trouble with my page. I have moved my site from a host provider to another one, and now i'm having some problems with non-latin characters, for text that comes from db query and for text that is in html/php file.
For text that comes from db someone suggested me to apply this after db connection:
mysql_query("SET CHARACTER SET utf8");
mysql_query("SET NAMES utf8");
and it did the trick, but, now i'm having the same problem for texts that comes from html/php files: instead of ë or ç appears �
I'm sure that should be e trick someone on the server or somewhere else on the configuration.
Hope that you can help me.
<meta http-equiv="content-type" content="text/html; charset=UTF-8" />
i'm using at the header of my file.
You must have this line in your <head> section:
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
Is the collation of your database where the data is stored in utf8_general_ci?
Maybe there was a problem while transfering the files.
If you are familiar with Linux, try to fix the broken files on your server with recode
(excerpt: "The Recode library converts files between character sets and usages.")

Convert html entities into charactes problem

link
Im having trouble converting the html entites into html characters, (&# 8217;) i have tried using al the different php functions (html_entity_decode, htmlspecial characters etc...) None seem to be working, any ideas what function i need to use?
Thank you!
Your problem isn't that the characters are not decoded correctly, but that the browser is misinterpreting the decoded characters.
As the page is encoded using UTF-8, you need to specify that in the header:
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">

Categories