Jump to content

mysql and mssql


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 post
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 post
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 post
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 post
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 post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...