Chinese data in SQL SERVER 2008 can't be displayed.

Discussion in 'Databases' started by waterding, Apr 26, 2010.

  1. I am using SQL Server 2008 to create a database called EmDb. Some of my data are in Chinese, it works ok locally. But when it’s in the hosting, some of the Chinese data cannot be displayed. Below are the cases.

    • All the Chinese data are using UTF8 encoding.
    • Both the local copy and the hosting copy of database is using collation Chinese_PRC_CI_AS. But the system databases called master and tempdb in the local SQL Server are using collation Chinese_PRC_CI_AS, while the ones in the hosting server are using collation SQL_Latin1_General_CP1_CI_AS.
    • In the hosting database, only Chinese data saved in filed whose data types are text couldn’t be displayed, while the ones whose data types are nvarchar are working properly.

    Can anyone help please?
     
  2. Ray

    Ray

    Unfortunately the way you save your data in the fields of the database will play a big role on how the data will be translated. I suggest you update your databsae so that the fields that is holding the chinese characters be saved and stored in a nvarchar data type.
     
  3. Thanks for your reply, Ray.

    I managed to get it working by changing the datatype from text to ntext.
     
  4. Ray

    Ray

    Cool. I didn't know that ntext will work in this situation. I learned something new. Thanks I'll make a mental note of this and pass this along to our other members.
     
  5. The collation of the text field is set to the system's default collation, which is Latin** in the server. You could either change the collation of the text filed to the one for your own language, or change the datatype to ntext instead. The former method needs to be done for all the filed that used text filed, while the later method is more straightforward.
     
  6. Thanks for the info.
     

Share This Page