Hi,
I am trying to show five different languages in my website. I am not using any other tool to achieve this task. Basically, I have stored the all language values in a language file. While in my pages, I include the language page and call the language varriables. I manage the languge value like english, spanish etc in my session varriable.
My problem is: There are some spcial characters in languages like italian, german for example : è,á ,ó ,Nº ,ñ etc and these are not shown properly in my browser. It shows like a sqare box which makes the complete sentense not readable and looks ugly. I think we need to install some kind of package in the client browser in order to show these special characters!! but honestly speaking, I have no idea how to solve it.
Any help in this regard is higly appritiated !!
Thank you
Santosh
Language Problem in PHP
Moderator: General Moderators
Re: Language Problem in PHP
It's an encoding problem. You need to make sure you serve the pages in a language encoding that supports the characters you're using ... UTF-8 is probably the right one for you unless you're serving pages in a non-western alphabet (eg Russian, Arabic, Chinese etc).
There are lots of ways to set the encoding.. I use a header like "header("Content-type: text/html; charset=utf8");", but you can set it in Apache's config file, or specify it in the HTML using a charset attribute or a meta tag... what you need to use depends entirely on the way your site it coded.
Whatever the case though, you don't need users to install anything. Browsers can do different languages no problem.
There are lots of ways to set the encoding.. I use a header like "header("Content-type: text/html; charset=utf8");", but you can set it in Apache's config file, or specify it in the HTML using a charset attribute or a meta tag... what you need to use depends entirely on the way your site it coded.
Whatever the case though, you don't need users to install anything. Browsers can do different languages no problem.
- Kieran Huggins
- DevNet Master
- Posts: 3635
- Joined: Wed Dec 06, 2006 4:14 pm
- Location: Toronto, Canada
- Contact:
Re: Language Problem in PHP
you need to specify the character encoding - UTF-8 is likely the best choice.
edit: er... what onion said.
edit: er... what onion said.
-
everurssantosh
- Forum Newbie
- Posts: 13
- Joined: Wed Jun 25, 2008 10:26 am
Re: Language Problem in PHP
what are the changes that i need to apply to my config file !!!
and if it is possible I can better add the piece of code in my pages itself..
kindly specify the code to be added for unicode ..
thanks
santosh
and if it is possible I can better add the piece of code in my pages itself..
kindly specify the code to be added for unicode ..
thanks
santosh
- Kieran Huggins
- DevNet Master
- Posts: 3635
- Joined: Wed Dec 06, 2006 4:14 pm
- Location: Toronto, Canada
- Contact:
Re: Language Problem in PHP
onion2k wrote:header("Content-type: text/html; charset=utf8");