RE: Japanese text in MSSQL database

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



I wanted to follow up on this because I didn't get any responses.  I did
eventually get proper Japanese text from the MSSQL database using a COM
object and the MS ADODB tools:

$obj=new COM('ADODB.connection',NULL,CP_UTF8);
$obj->open("Provider=sqloledb;Data Source=$server,1433;Network
Library=DBMSSOCN;Initial Catalog=$database;User
ID=$username;Password=$password;")

I set this up in a custom ADODB class and simply used it to re-populate
international fields in the data I was already getting from PDO.  It's a
pretty sloppy solution but it was easier to continue using the PDO
interface for the majority of my code.

Hope this helps someone in the future :)

-----Original Message-----
From: Mike Matz [mailto:mmatz@xxxxxxxxxxxxx] 
Sent: Wednesday, March 14, 2007 11:54 AM
To: php-windows@xxxxxxxxxxxxx
Subject:  Japanese text in MSSQL database

Hello,
 
I'm working with an MSSQL 2000 database that contains Japanese
characters in ntext columns.  I'm not entirely sure how to see what
encoding or charset it's using, but there is a ColdFusion admin
application that can display the data in UTF8 as well as accept the
data.  I'm trying to access this data from PHP for import into a MySQL
database, and I'm currently using the PDO ODBC driver.  I had difficulty
getting other drivers working when I began importing data, either due to
the charset/encoding on these fields or due to the long text in some of
the fields, and the PDO ODBC driver in PHP 5.2.0+ was the one that
seemed to work the best.  However, I'm just now realizing that the
Japanese characters are being replaced with "?" characters when I do the
select.  I found I had this problem on the MySQL end before, but I
solved it by adding some SQL calls when initializing the connection:
 
   "SET CHARACTER SET utf8",
   "SET collation_connection = 'utf8_general_ci'",
   "SET character_set_database = utf8",
   "SET character_set_server = utf8",
   "SET character_set_client = utf8",
   "SET character_set_filesystem = utf8",

Is there something similar I need to do with MSSQL?  Is there an option
in the PDO ODBC driver I need to set somehow?  I'm guessing there's
probably a simple solution but thus far I've been unable to find
anything.  Any help or insight would be greatly appreciated!
 
Thanks,
Mike

-- 
PHP Windows Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[Index of Archives]     [PHP Home]     [PHP Users]     [PHP Database Programming]     [PHP Install]     [Kernel Newbies]     [Yosemite Forum]     [PHP Books]

  Powered by Linux