Reputation: 9506
I'm using SQL server with an intranet application written in PHP. For convenience i want to use UTF8 charset for web pages (jquery supports only utf8) however all data stored in my sqlserver db is in iso-8859-1. Can I change just the data CONNECTION CHARSET (not data store charset) between sqlserver and PHP? Maybe just with a query header?
Thank you.
Upvotes: 1
Views: 275
Reputation: 1122
SQL server only stores Unicode data in tables prefixed with N
(so NVARCHAR
etc). These are stored in the UCS-2 format. The Windows SQLSRV driver will convert those columns from UCS-2
to UTF-8
when retrieving, and the opposite when saving.
However, if the data is ISO-8859-1
(non-N
columns) then you will need to convert the text yourself. I would suggest creating a wrapper function on your data retrieval methods to convert ISO-8859-1
data to UTF-8.
Upvotes: 1