tags:

views:

39

answers:

1

How can I have my code replace the body text rather than just "returning":

if($body == "Garçon") 
    return;

Also, since == is looking for exact string of text, how do I make it look for the body containing "Garçon"?

Essentially, I'm trying to build in a filter to change "Garçon" to "Garcon" since the special "ç" character comes up "null" in my database.

Thanks for your help.

+4  A: 

You don't have to filter anything, nor replace any symbols.
Just setup your database to use utf8 encoding.

if your database is fresh new, create your tables with CHARACTER SET=utf8 option.

and add to your PHP scripts this call, right after db connect:

mysql_set_charset("<encoding>");

where <encoding> is the actual encoding of your pages

Col. Shrapnel
BigMike
@BigMike it's hard to tell without an actual example of such "incorrectly passed character". But anything can be corrected with PHP script as well. Anything being passed via URL should be properly encoded, like PHP `urlencode()` function does.
Col. Shrapnel
ok, great. Thanks. I'll have a look at my objective-c code and make sure things are properly encoded.
BigMike