MS SQL server Unicode handling

Hi experts,

I have a web application that needs to support many languages including non latin character sets like, Russian, Chinese & Arabic.  We are using .php and the Yii framework.  Problem is when we write to SQL server even with the nvarchar type set the db columns, they contain ???? instead of the proper characters.  Now, if I use visual studio management studio and cut and paste the Chinese chars in directly they look ok.  

Firstly, what settings do I need to setup the MS SQL server to support UTF-8 and non latin char sets, could I have the TSQL required?
Secondly, why does this go wrong when we write to the db in .php?

Thanks for your help in advance.
MOSSPOINTAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Deepak ChauhanSQL Server DBACommented:
you can try like this.

Insert into table values (N'XYZ')
0
Ray PaseurCommented:
This is an increasingly common problem as more of the world comes online.  This article sheds some light on it.  There is not any "one easy fix" but if you get all of the settings right, things will work correctly.  The HTML, PHP and database all have to have their character encoding set up correctly.  Your text editor may be in play, especially if you cut-and-paste characters.  Make sure your scripts are stored in UTF-8 encoding.
http://www.experts-exchange.com/Web_Development/Web_Languages-Standards/PHP/A_11880-Unicode-PHP-and-Character-Collisions.html

Unfortunately, Microsoft does not really make it as easy as the other, free and open-source databases...
https://support.microsoft.com/en-us/kb/232580

... but they offer some online guidance.
https://msdn.microsoft.com/en-us/library/cc626307%28v=sql.105%29.aspx
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft SQL Server

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.