displaying foreign languages in PHP

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
davidklonski
Forum Contributor
Posts: 128
Joined: Mon Mar 22, 2004 4:55 pm

displaying foreign languages in PHP

Post by davidklonski »

Hello

I am trying to display foreign languages in PHP.
The translations for all the words need to be stored in PHP files.

Can anyone tell me what sort of encoding I need to use?
Does PHP support unicode?
If not, how do I save the foreign languages in the files?

what sort of character set do I need to use in the generated HTML pages?

thanks in advance
User avatar
Weirdan
Moderator
Posts: 5978
Joined: Mon Nov 03, 2003 6:13 pm
Location: Odessa, Ukraine

Post by Weirdan »

  • PHP has unicode support via mb_* functions
  • Even if you don't use that functions, you can set the Content-type header to include the character set used (actualy, you must do it to be compliant with http standards).
So.. [php_man]header[/php_man], [php_man]mb_[/php_man], ftp://ftp.isi.edu/in-notes/rfc2616.txt
davidklonski
Forum Contributor
Posts: 128
Joined: Mon Mar 22, 2004 4:55 pm

Post by davidklonski »

I am trying to do something like:

Code: Select all

<?php
$var1 = '<Japanse word>';
$var2 = '<French word>';
?>
where <Japanese word> is an actual word in Japanese and the same goes for the French word

is it possible?
Under what sort of encoding do I need to store the file?

If I will later print those variables, will the output be in Japanese and French?

thanks
kyokutan
Forum Newbie
Posts: 2
Joined: Fri Apr 09, 2004 6:38 am

Post by kyokutan »

for japanese i enabled the mbstring.lanaguage = japanese in my php.ini file and also changed the default header to UTF-8.

i'm able to work with japanese characters now... though i'm not sure about the french side of things.

cheers.
Post Reply