Jump to content

PHP, ADODB and Unicode


nzseries1

Recommended Posts

Hi everyone,

 

Can someone please tell me how come my unicode is getting replaced by question marks? In my database I have three unicode first names, and one name "John". As you can see, the encoding on my resulting web page is correct as the first two chinese characters print correctly (well they do on my display). Here is the output (the code is displayed below):

 

--------------------------------

 

[pre]TEST - 河南

First Name: ??

First Name: ??

First Name: ??

First Name: John[/pre]

 

--------------------------------

 

CODE IS AS FOLLOWS:

$db = getcwd().'\..\..\testdb.mdb'; 
$conn = new COM('ADODB.Connection'); 
$conn->Open("Provider=Microsoft.Jet.OLEDB.4.0; Data Source=$db"); 
$query = "SELECT firstname FROM Trainers"; 
$result = $conn->execute($query); 

print("TEST - 河南"."<BR><BR>"); 

while (!$result->EOF) { 
  print("First Name: ".$result->Fields["firstname"]->value."<BR>"); 
  $result->MoveNext(); 
} 

 

When I view the table in Microsoft Access, the unicode characters display correctly.  Any help to determine why question marks appear in the resulting php would be very useful.

 

Thanks very much in advance,

Matthew

Link to comment
https://forums.phpfreaks.com/topic/44421-php-adodb-and-unicode/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.