Hello all,
I am working on a database that is made in Finnish language. And of course, we have ä,ö and å in our language.
The problem is that, when I export the data in .xls file, I see very wierd characters insted of desired characters. Can somebody please help me in it?
The code for exporting file is here:
<?php
if ($_POST['verify_epshp_export']=="ok") {
$db_username = "student";
$db_password = "itk215";
$db_name = "itk215";
$mysql_link = mysql_connect( "localhost", "$db_username", "$db_password") or die( "Unable to connect to database server");
@mysql_select_db( "$db_name") or die( "Unable to select database");
header("Content-type: application/vnd.ms-excel");
$size_in_bytes = strlen($csv_output);
header("Content-disposition: attachment; filename=" . date("Y-m-d").".xls; size=$size_in_bytes");
$sql = "SELECT * FROM ktl_epshp";
$result = @mysql_query($sql,$mysql_link );
if (!$result) {
echo( "<P>Unable to execute query at this time.</P>" );
exit();
}
echo "\"Sairaanhoitopiiri\"\t";
echo "\"Toimipaikkatyyppi\"\t";
echo "\"Kuntayhtymä\"\t";
echo "\"Mukana hankkeessa\"\t";
echo "\"Yksikkö\"\t";
echo "\"Paikkakoodi\"\t";
echo "\"Sokerirasituskokeen näytteen ottopaikka\"\t";
echo "\"Glukoosin määritysmenetelmä\"\t";
echo "\"Yhteyshenkilö\"\t";
echo "\"Terveyskeskus\"\t";
echo "\"TK jatko\"\t";
echo "\"Katuosoite\"\t";
echo "\"Postiosoite\"\t";
echo "\"Puhelin\"\t";
echo "\"Toinen yhteyshenkilö\"\t";
echo "\"Note\"\t";
echo "\n";
while ($row = mysql_fetch_array($result)) {
$sairaanhoitopiiri=$row['sairaanhoitopiiri'];
$toimipaikkatyyppis=$row['toimipaikkatyyppi'];
$kuntayhtym=$row['kuntayhtym'];
$mukanahankkeessa=$row['mukanahankkeessa'];
$yksikko=$row['yksikko'];
$paikkakoodi=$row['paikkakoodi'];
$sokerirasituskokeennytteenottopa=$row['sokerirasituskokeennytteenottopa'];
$glukoosinmritysmenetelm=$row['glukoosinmritysmenetelm'];
$yhteyshenkilo=$row['yhteyshenkilo'];
$terveyskeskus=$row['terveyskeskus'];
$tkjatko=$row['tkjatko'];
$katuosoite=$row['katuosoite'];
$postiosoite=$row['postiosoite'];
$puhelin=$row['puhelin'];
$toinenyhteyshenkilo=$row['toinenyhteyshenkilo'];
$note=$row['note'];
echo "\"$sairaanhoitopiiri\"\t";
echo "\"$toimipaikkatyyppis\"\t";
echo "\"$kuntayhtym\"\t";
echo "\"$mukanahankkeessa\"\t";
echo "\"$yksikko\"\t";
echo "\"$paikkakoodi\"\t";
echo "\"$sokerirasituskokeennytteenottopa\"\t";
echo "\"$glukoosinmritysmenetelm\"\t";
echo "\"$yhteyshenkilo\"\t";
echo "\"$terveyskeskus\"\t";
echo "\"$tkjatko\"\t";
echo "\"$katuosoite\"\t";
echo "\"$postiosoite\"\t";
echo "\"$puhelin\"\t";
echo "\"$toinenyhteyshenkilo\"\t";
echo "\"$note\"\t";
echo "\n";
}
}
?>