Forum Moderators: coopster
How come when I do
<? echo 'ö'; ?> it outputs š
--
I've tried htmlspecialchars() it, htmlentities() it, and everything what am I doing wrong here, I even tried changing the <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1" /> in the head, and that didn't do anything either.
That works, but sorry I should been a little bit more clear. I'm taking to take in that variable. from Mysql.
---
$var = 'ö';
echo $var;
prints out š
---
It's almost like PHP doesn't understand: ö
and then trying to do like
$var = 'ö';
echo htmlentities($var);
still outputs š
--
Any ideas?
$var = "ö"
echo $var;
or if your funny o is being stored in the database, store it as ö
then $var=$row['funny_o_coloumn'];
(based on circumstantial evidence)
Failing that, i'd go straight to a foreign language PHP site/forum where that letter gets used more often in the native language for names and suchlike.
[edited by: Esqulax at 10:30 am (utc) on Mar. 6, 2008]
if it's coming from mysql then you should look at the charset for mysql
php doesn't really care, it just shows the data it has, the browser/html control how it is displayed. Have you ever swapped charsets, saved, reloaded, you can get the chars to turn into all sorts of things. Is php changing the data, of course not, but the browser is interpreting it differently.
seems like a backwards way correct, I mean that would work but it doesn't seem natural at all.
jatar_k, "hp doesn't really care, it just shows the data it has,"
Thats what I don't understand tho, even if we remove mysql from the equation:
$var = 'ö';
echo $var;
prints out š
--
It seems like php doesn't recognize that data. Php not recognizing the symbol ö at all? Because I can't even set =ö by itself, and then call it agian with php, it changes to š.
Its almost like PHP thinks ö = š, but š is it's own special character but itself?
Is there like a function I need to force charset on php to recognize the ö
looking at 2 charts right now and and š is either š or Ü so, as I mentioned, it has nothing to do with php, the same data can be interpreted in various ways depending on charset.
when you paste in that ö it depends on what is actually sent.