When I tried to get chinese characters from the database, I got weird text.
I tried almost everything, like html_entity_decode
, htmlentities
, save the
I encountered this issue a while ago and the only way I could get it to work was to write the HTML into an ADODB.Stream
object, save it to a file, and then echo
the file:
Type = 2; // adTypeText
$stm->Charset = 'utf-8';
$stm->Open();
$stm->WriteText('');
$stm->WriteText('');
$stm->WriteText('');
$stm->WriteText('ADODB test ');
$stm->WriteText('');
$stm->WriteText('');
$con = new COM("ADODB.Connection");
$con->Open(
"Driver={Microsoft Access Driver (*.mdb, *.accdb)};" .
"Dbq=C:\\Users\\Public\\Database1.accdb");
$rst = $con->Execute("SELECT word FROM vocab WHERE ID=3");
$stm->WriteText($rst->Fields("word"));
$rst->Close();
$con->Close();
$stm->WriteText('');
$stm->WriteText('');
$tempFile = TEMP_FOLDER . uniqid("", TRUE) . ".txt";
$stm->SaveToFile($tempFile, 2); // adSaveCreateOverWrite
$stm->Close();
echo file_get_contents($tempFile);
unlink($tempFile);
?>