Welcome Guest, Not a member yet? Register   Sign In
Problem with accents
#1

[eluser]caperquy[/eluser]
Hello
I have the following problem : within my controller I read a data from my database, let say écologie which I put into a variable $a.
When I echo $a (echo "value of a : $a <br />"Wink I get écologie which is exactly what I expect.
Now I want to replace the first character with e (no accent)
I thefore catch that character with the instruction $car1=substr($a,0,1);
If I echo $car1 (echo "value of car1 : $car1 <br />"Wink I do not get é as expected but rather an unreadable character (�)
I suspect a problem with the character sets but I cannot find where.
Could someone give me a clue ? Thanks in advance
CapErquy
#2

[eluser]tomcode[/eluser]
PHP functions like substr() are only safe to use for ASCII chars, have a look at Multibyte String




Theme © iAndrew 2016 - Forum software by © MyBB