Jump to content

mysql and mssql


suzie

Recommended Posts

Dear, in Mysql database with collation utf8, I inserted arabic data, after retreiving them using php with charset=utf-8I used mysql_query("set names utf8"); the problem is solvedis there an alternative for this query if we are reading from mssql..thank you

Link to comment
Share on other sites

In MS SQL, unicode strings are stored with separate types (nchar, nvarchar, etc.), so there's no need to do that.BTW, using mysql_set_charset() is really the appropriate way to set UTF-8 charset, unless you're using a PHP version earlier than 5.2.3.

Link to comment
Share on other sites

I'd strongly reccomend that you switch to either PDO or the sqlsrv extension. It's pretty trivial with them.For ODBC... you could try adding

;CharacterSet=UTF-8

to your connection string, but I have no idea if it would work.

Link to comment
Share on other sites

Add it at the end of the value of the $db variable (that's really your connection string). What's its current value anyway?

Link to comment
Share on other sites

I said the $db variable, not the odbc_connect() function...Find the place where you have "$db =". It should look something like:

$db = 'Server=localhost;Database=whatever_the_name_of_your_database_is';

Add ";CharacterSet=UTF-8", i.e. turn it into:

$db = 'Server=localhost;Database=whatever_the_name_of_your_database_is;CharacterSet=UTF-8';

Link to comment
Share on other sites

Archived

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

×
×
  • Create New...