Retrive Unicode data from MSSQL 2005 to PHP 4

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
neptun
Forum Newbie
Posts: 2
Joined: Tue Dec 22, 2009 3:20 am

Retrive Unicode data from MSSQL 2005 to PHP 4

Post by neptun »

Hi,

I am using PHP 4.4.2 with MSSQL 2005.

When I tried to retrieve data from a column of type ntext in PHP, I receive the following error:

Unicode data in a Unicode-only collation or ntext data cannot be sent to clients using DB-Library (such as ISQL) or ODBC version 3.7 or earlier. (severity 16) in C:\Program Files\Apache2…

If I change the type of the column from ntext to text, it works just fine.

The problem is that I cannot change the column type (or to cast it) to text, because I need the unicode characters in the database, like “à” for example.

If I change the column type from ntext to text, “à” becomes “a”, witch is not good. If I leave the ntext column type, PHP brings me that error.
On the PHP site, they said it is not a bug, but PHP doesn’t recognize the Unicode colums from MSSQL (nchar, nvarchar, ntext).

Do you have any idea on what should I do?

Thanks,
Adrian
neptun
Forum Newbie
Posts: 2
Joined: Tue Dec 22, 2009 3:20 am

Re: Retrive Unicode data from MSSQL 2005 to PHP 4

Post by neptun »

I have found the solution, wich is: changing the collation type for the database in : Latin1_General_CI_AI
But it still remains one more thing to do : to change the collation of the columns already created in the database, witch have the old collation type.
Post Reply