Special Characters

Hi Chaps, im in a bit of a dilemma…

Im building a multi language site with loads of accents in database titles etc.

Thrown into this im using modwrite for seo friendly links. So after i send a link, the initial variables to pull down the record are:

$test1 = $_GET[‘wine’];
$test2 = str_replace( “-”, " ", $test1 );

based on the modrewrite:

rewriteRule ^wines/(.*)$ /wine2.php?wine=$1&lang=en [NC,L]

(note: the (.*) is only for testing at the moment)

Then, i select a record with a Title of $test2. All works fine until i come to a name with a special character…then its fails (i.e. no record is retrieved)

In the database i have used html coding for the ‘Titles’, i.e Popìne for Popìne.

Because of the amount of accents possible, i was thinking would it be best to add the special characters without the html markup, and then somehow process them later to appear in the correct format on the page…

could someone give me some pointers?

many thanks in advance


Well, you shouldn’t have done that.

Yep. Store text in the database as text - not html. You would want to use a charset that covers all the possible characters. UTF-8 has you covered for this. In general, defaulting to UTF-8 is a good idea, because it saves you from having to go through a painful migration later on.

The accents/special characters will look fine in html, if you just serve the page in UTF-8 as well.

Thanks Kyber…for the db i have it set to utf8_general_ci and in the html head i have utf-8

…and accent characters show with the black diamond and ‘?’ in the browser

in the source code, its producing

wines/Pop%EF%BF%BDne" title=“Pop�ne DOCG Chianti”>Pop�ne</a>

Consider reading up a bit on unicode, character sets, and character encodings. It’s time well spent.

wel, thats what i did before i did the post…‘apparently’ the setup is correct.

Ive even setup another database to ensure that no bad encoding was moved over.