Click here to Skip to main content
15,896,063 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hello all,
My question is simple: I can't convert the string to UTF-8 in PHP...

Original string: Qui prot�ge avec sagesse
Must be: Qui protège avec sagesse

I have tried "utf8_encode()" function of PHP.. Nothing!

And I have searched and tried all the stuff of "iconv" -> http://www.php.net/manual/en/function.iconv.php[^] ... Nothing!

You can see all my tries of "iconv":

Original String: Qui prot�ge avec sagesse
--------------------------------------------------------------------------------------------
[UTF-8] [UTF-8] ->Qui prot�ge avec sagesse
[UTF-8] [ASCII] ->Qui prot
[UTF-8] [Windows-1252] ->Qui prot�ge avec sagesse
[UTF-8] [ISO-8859-15] ->Qui prot�
[UTF-8] [ISO-8859-1] ->Qui prot�ge avec sagesse
[UTF-8] [ISO-8859-6] ->Qui prot
[UTF-8] [CP1256] ->Qui prot�
[ASCII] [UTF-8] ->Qui prot
[ASCII] [ASCII] ->Qui prot
[ASCII] [Windows-1252] ->Qui prot
[ASCII] [ISO-8859-15] ->Qui prot
[ASCII] [ISO-8859-1] ->Qui prot
[ASCII] [ISO-8859-6] ->Qui prot
[ASCII] [CP1256] ->Qui prot
[Windows-1252] [UTF-8] ->Qui prot�ge avec sagesse
[Windows-1252] [ASCII] ->Qui prot
[Windows-1252] [Windows-1252] ->Qui prot�ge avec sagesse
[Windows-1252] [ISO-8859-15] ->Qui prot�
[Windows-1252] [ISO-8859-1] ->Qui prot�ge avec sagesse
[Windows-1252] [ISO-8859-6] ->Qui prot
[Windows-1252] [CP1256] ->Qui prot
[ISO-8859-15] [UTF-8] ->Qui protᅵge avec sagesse
[ISO-8859-15] [ASCII] ->Qui prot
[ISO-8859-15] [Windows-1252] ->Qui protᅵge avec sagesse
[ISO-8859-15] [ISO-8859-15] ->Qui prot�ge avec sagesse
[ISO-8859-15] [ISO-8859-1] ->Qui prot�
[ISO-8859-15] [ISO-8859-6] ->Qui prot
[ISO-8859-15] [CP1256] ->Qui prot
[ISO-8859-1] [UTF-8] ->Qui prot�ge avec sagesse
[ISO-8859-1] [ASCII] ->Qui prot
[ISO-8859-1] [Windows-1252] ->Qui prot�ge avec sagesse
[ISO-8859-1] [ISO-8859-15] ->Qui prot�
[ISO-8859-1] [ISO-8859-1] ->Qui prot�ge avec sagesse
[ISO-8859-1] [ISO-8859-6] ->Qui prot
[ISO-8859-1] [CP1256] ->Qui prot
[ISO-8859-6] [UTF-8] ->Qui protأ
[ISO-8859-6] [ASCII] ->Qui prot
[ISO-8859-6] [Windows-1252] ->Qui prot
[ISO-8859-6] [ISO-8859-15] ->Qui prot
[ISO-8859-6] [ISO-8859-1] ->Qui prot
[ISO-8859-6] [ISO-8859-6] ->Qui prot�
[ISO-8859-6] [CP1256] ->Qui prot�
[CP1256] [UTF-8] ->Qui protأ¯آ؟آ½ge avec sagesse
[CP1256] [ASCII] ->Qui prot
[CP1256] [Windows-1252] ->Qui prot
[CP1256] [ISO-8859-15] ->Qui prot
[CP1256] [ISO-8859-1] ->Qui prot
[CP1256] [ISO-8859-6] ->Qui prot�
[CP1256] [CP1256] ->Qui prot�ge avec sagesse
-------------------------------------------------------------------------------------------


Please help me out..
Regards,
KZ
Posted
Comments
Killzone DeathMan 3-Sep-13 9:34am    
nobody???
ok then..
I must handle it manually: "$string = str_replace('�', 'è', $string);"
:(
Mohibur Rashid 3-Sep-13 21:38pm    
first thing is, you cannot show or use multiple encoding in the same file. as well as in the same page of html. i.e.
whatever encoding use, you will have to convert everything into same encoding.
utf8_encode() function works with ISO-8859-1. this function will only convert IS0-8859 to utf8

make sure you put meta information to your page, that describe your page used encoding.
Killzone DeathMan 5-Sep-13 8:15am    
I think the string is wrong encoded, and there build "trash" into the string like "�" and now I cannot convert it anymore

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900