Kasper Katzmann
asked on
Set locale
I have a script that extracts data from a mysql database. I works great until I extract a text that contains danish characters like æ, ø and å.
The output looks like this:
Tilmeld dig vores nyhedsbrev og v¿r med i konkurrencen om et gavekort p¿ 25.000 kr til dit favorit indk¿bscenter!
but it should look like this:
Tilmeld dig vores nyhedsbrev og vær med i konkurrencen om et gavekort på 25.000 kr til dit favorit indkøbscenter!
The script is this one:
What must I do to replace those anoying ¿ with the danish characters.
Best regards
Kasper K
The output looks like this:
Tilmeld dig vores nyhedsbrev og v¿r med i konkurrencen om et gavekort p¿ 25.000 kr til dit favorit indk¿bscenter!
but it should look like this:
Tilmeld dig vores nyhedsbrev og vær med i konkurrencen om et gavekort på 25.000 kr til dit favorit indkøbscenter!
The script is this one:
<?php
$link = mysql_connect('mysql.myserver.dk:3306', 'username', 'password');
if (!$link) {
die('could not connect: ' . mysql_error());
}
mysql_select_db('database_bk', $link);
$my_date=date('c');
$query="select * FROM `content_type_konkurrence` WHERE '$my_date' BETWEEN `field_konk_start_value` AND `field_konk_slut_value`";
$result=mysql_query($query) or die(mysql_error());
while($row=mysql_fetch_assoc($result)) {
echo "
<a class='konk_link' href='" . $row['field_konk_url_value'] . "'><div class='konk_div'>
<img src='http://www.mydomain.dk/files/" . $row['field_konk_billede_value'] . "' alt='" . $row['field_konk_titel_value'] . "' class='konk_billede' />
<span class='konk_tekst'><b class='konk_titel'>" . $row['field_konk_titel_value'] . "</b><br /><br />" . $row['field_konk_tekst_value'] . "</span></div></a><br />";
}
mysql_close($link);
?>
What must I do to replace those anoying ¿ with the danish characters.
Best regards
Kasper K
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Yeah it is that easy, but trust me, I created a whole method to begin with to work around the problem until I discovered how little it took to make it work.
I'm looking forward to the beer :-)
I'm looking forward to the beer :-)
ASKER
Was it that easy. I have tried with setlocale, but that didn't work at all. But you suggestion worked at once.
Thank you very much.
Jeg gi'r en øl (I buy you a beer)