Problems in characters of non-English language

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
GirishR
Forum Newbie
Posts: 11
Joined: Wed May 19, 2004 6:48 am
Contact:

Problems in characters of non-English language

Post by GirishR »

Hello all,

When reading a file contents(html or any) using PHP how are we suppose to process the characters that are not in English alphabet?

Unfortunatly this message editor of PHPBB is converting all non English character to ? but i have tried to give a example below.

For example in Wspólnie pa?dziernika (i think its Polish), characters like ó,? are treated as ?(was suppose to be a square rather that a ?) when PHP is used to read them from a file. Is there a simple fix for it?

I hope I have made myself clear.

Thanks
Girish R
User avatar
Weirdan
Moderator
Posts: 5978
Joined: Mon Nov 03, 2003 6:13 pm
Location: Odessa, Ukraine

Post by Weirdan »

Yep, looks like a Polish or Czech to me.

Perhaps you need to set right encoding for html page (Assuming that file is sent to browser then).
As far as I know, fread is binary safe. Actually, PHP is not supposed to know anything about encodings
but read the file contents as-is. Still there are functions for unicode ([php_man]mb_[/php_man]*), and
[php_man]recode[/php_man] extension.
GirishR
Forum Newbie
Posts: 11
Joined: Wed May 19, 2004 6:48 am
Contact:

Post by GirishR »

Thanks for that comment. Actualy i posted this same problem in phpbuilder.com forum and got a quick answer to that. It was to use utf8_encode() to the strings read by fopen or any other file read method.

Any how thanks for your commets.

Regards
Girish R
Post Reply