Poormandm
asked on
str_replace unicode Error
I try to convert string to unicode but I can't save the script because the server doesn't run the code. The server display the whole script.
Please copy the text below into notepad or any text editor and save as something.php and please remember to pick the encoding option to be Unicode.
<?php
$a = "a` a('";
$a = str_replace(array("a`", "a('"), array("à ", "ắ "), $a);
echo $a;
?>
Please copy the text below into notepad or any text editor and save as something.php and please remember to pick the encoding option to be Unicode.
<?php
$a = "a` a('";
$a = str_replace(array("a`", "a('"), array("à ", "ắ "), $a);
echo $a;
?>
If you see the source of the file, then your webserver is not configured to execute php-scripts correctly. As long as the "<?php" is not encoded in unicode and your webserver is configured correctly you will not see the code of your script.
ASKER
thanks
ASKER
let me try to build the include file and include that file in to see if php server can understand it.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
ASKER
experts-exchange.com change my unicode to some strange numbers
the ấ is actually the letter a( but the ( is on the top of the a.
That give me a hint, I should convert my unicode to ascii then use it.
Oh yes..
thanks
the ấ is actually the letter a( but the ( is on the top of the a.
That give me a hint, I should convert my unicode to ascii then use it.
Oh yes..
thanks
ASKER
transfrom
a á à ạ ả ã
ă ắ ằ ặ ẳ ẵ
â ấ ầ ậ ẩ ẫ
e é è ẹ ẻ ẽ
ê ế ề ệ ể ễ
u ú ù ụ ủ ũ
ư ứ ừ ự ử ữ
i í ì ị ỉ ĩ
o ó ò ọ ỏ õ
ơ ớ ờ ợ ở ỡ
ô ố ồ ộ ổ ỗ
đ
Hey! Glad to have helped. (Did I?).
What happens if you encode both pages as UTF-8? That SHOULD work better.
What happens if you encode both pages as UTF-8? That SHOULD work better.