Hi
Im trying to use <meta....Encoding="utf-8"> while my php vars use hebrew characters and i get Scrumbled japaneese font instead of HEBREW
When i use encoding="windows-1255" it is ok ofcourse
But i would like to work unicode.
This issue occures when i use text from vars and DB (not static in an html pure code)
My server is runing IIS 6 . Windows 2003
Where can i change / fx configuration to have this problem fixed ?
Thanks ,
Moshe
Using UTF-8 encoding in php files/output HTML
Moderator: General Moderators
- Pyrite
- Forum Regular
- Posts: 769
- Joined: Tue Sep 23, 2003 11:07 pm
- Location: The Republic of Texas
- Contact:
Not sure what you are saying exactly, but I work with unicode/php a lot.
A common way to store text is in language files. eg. mysitetext-he.php, mysitetext-en.php etc.
Then you save your text in vars in those files, and save the files encoded with UTF-8 but without the BOM (Byte Order Mark) at the beggining. Then on a webpage you can include the language file of the user's choice and print the text. Make sense? Besure to set your webpage charset to utf-8. Also, you must have some type of Hebrew Unicode font installed, simply a Hebrew font is not enough, must be a unicode font.
To remove the BOM from a UTF-8 encoded php file, you can use the DOS Edit command, Yudit, EmEditor ... to name a few.
A common way to store text is in language files. eg. mysitetext-he.php, mysitetext-en.php etc.
Then you save your text in vars in those files, and save the files encoded with UTF-8 but without the BOM (Byte Order Mark) at the beggining. Then on a webpage you can include the language file of the user's choice and print the text. Make sense? Besure to set your webpage charset to utf-8. Also, you must have some type of Hebrew Unicode font installed, simply a Hebrew font is not enough, must be a unicode font.
To remove the BOM from a UTF-8 encoded php file, you can use the DOS Edit command, Yudit, EmEditor ... to name a few.
Unicode
Hi
My problem is not the file itself, i have the vars in a lang file (heb.inc.php/eng.inc.php) , the problem is that when the browser encodes the output it sends it as Japaneese like , instead of Hebrew.
here is an example:
<html>
<meta content="text/html; charset=UTF-8" http-equiv="content-type">
<?
$mytext="שלום לכולם";
print $mytext;
?>
</html>
this output strange characters ...
Thanks Moshe
My problem is not the file itself, i have the vars in a lang file (heb.inc.php/eng.inc.php) , the problem is that when the browser encodes the output it sends it as Japaneese like , instead of Hebrew.
here is an example:
<html>
<meta content="text/html; charset=UTF-8" http-equiv="content-type">
<?
$mytext="שלום לכולם";
print $mytext;
?>
</html>
this output strange characters ...
Thanks Moshe
- Chris Corbyn
- Breakbeat Nuttzer
- Posts: 13098
- Joined: Wed Mar 24, 2004 7:57 am
- Location: Melbourne, Australia
- Pyrite
- Forum Regular
- Posts: 769
- Joined: Tue Sep 23, 2003 11:07 pm
- Location: The Republic of Texas
- Contact:
Sometimes your webserver might not be setup to handle hebrew fonts, an easy way around fixing it is instead to force a utf-8 header to the browser, so before any output you can do.
Code: Select all
header('Content-Type: text/html; charset=utf-8');