0

I am running SQL Server 2008R2 and have a table.column with a mix of latin and Chinese characters. Here is an example; 'Admissions Department - 招生办' the data type is set to 'nvarchar' (I've also tried ntext with no luck). Running PHP 5.4, I can't seem to get the text to display correctly.
Here is my SQL statement:

SELECT dbo.R_visitor_signin_departments.id,
dbo.R_visitor_signin_departments.department_name,
dbo.R_visitor_signin_departments.employee_id,
dbo.R_visitor_signin_departments.campus_id
FROM dbo.R_visitor_signin_departments

When I run the query and echo 'department_name' I get: Admissions Department - ???
My collation is set to Latin1_General_CI_AS.

Nathan
  • 59
  • 1
  • 14
  • Are the values stored correctly in the database? are you sure you're using UTF-8 encoding when printing? try, under PHP, `mysql_set_charset("utf8");`(use similar functions according to the sql library you're using) (for the DB) and `header('Content-Type: text/html; charset=UTF-8');` (for the output) – briosheje Mar 25 '14 at 08:04
  • I'm using a SQL Server (mssql) not mysql – Nathan Mar 25 '14 at 08:22
  • check this out then: http://stackoverflow.com/questions/13377812/getting-data-with-utf-8-charset-from-mssql-server-using-php-freetds-extension and, if it still doesn't help, this: http://stackoverflow.com/questions/1322421/php-sql-server-how-to-set-charset-for-connection – briosheje Mar 25 '14 at 08:41

0 Answers0