Multilanguage problems!

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
gubak
Forum Newbie
Posts: 3
Joined: Tue Jul 12, 2005 12:07 am

Multilanguage problems!

Post by gubak »

I am developing a web site and my website needs to show some special characters like čćšđž. I use utf-8 charset and it's work but not in every situation. It's a little bit complicated, but I will try to explain it. So my website works in a following way. My website has some unchanging parts like header, menu, advertisements etc. and has the changing part, which is always attached to the main php file (include 'content.php'). Content.php gets some datas from txt file (so uses file operations like fopen, fread etc.) and some characters of this datas are showed incorrectly. But if I change the Encoding of my browser to Central European(Windows), this datas gotten from txt file are showed correctly, but the another parts of my website are showed incorrectly.
Can somebody tell me how to fix my problem?

Thank you!
User avatar
onion2k
Jedi Mod
Posts: 5263
Joined: Tue Dec 21, 2004 5:03 pm
Location: usrlab.com

Post by onion2k »

If you're just echo'ing the data from the text files then I'd suggest that the data in them has been encoded incorrectly. The best way to find out (I reckon) is to download SC Unipad (http://www.unipad.org/main/) and open the files in that. It's shareware, but it works for just checking things.

Alternatively, if you're doing anything with the data, make sure you're using the multibyte string functions rather than the ordinary ones: http://uk2.php.net/manual/en/ref.mbstring.php
gubak
Forum Newbie
Posts: 3
Joined: Tue Jul 12, 2005 12:07 am

Post by gubak »

Thank you, I get the answer!
theda
Forum Contributor
Posts: 332
Joined: Sat Feb 19, 2005 8:35 am
Location: USA

Post by theda »

Also, you may want to try different encodings. My website has both English and German characters (including the ae, oe, ue characters), and ended up having to sift through about a hundred encodings to find the right one.

http://www.iana.org/assignments/character-sets <- Click this link, and search for the correct encoding for your character set. Make sure you copy the text to the right of the first "alias" listing. Hope this helps ^_^.
Post Reply