I have PHP talking to SQLServer through ODBC using FreeTDS and unixODBC. I followed tutorials to get this setup. It's working fine now although special characters in the database are not showing up correctly. Specifically, the ™ symbol. It's showing up in the browser as �. I've tried setting
client charset = UTF-8 in the [global] section of freetds.conf. I've tried
iconv('UCS-2', 'UTF-8', $str) and
mb_convert_encoding($str, 'UTF-8', 'UCS-2') within PHP and both result in asian character sets (
䐧祲圠攮戮餮吠渭捥❫). I'm stumped! Anyone have any tips?
One other element that bears mentioning: When I run this code on my local machine, I don't have these issues. The ™, for example, shows up fine. My local machine is a mac and I'm using Actual Technologies ODBC driver. Where I'm having trouble is our LAMP webserver. This leads me to believe that problem lies in the driver configuration. Or possibly linux as whole needs to be informed of UTF-8?
As it shows in the browser with that symbol, have you confirmed that the HTML page has the correct charset?
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
If so, have you confirmed you are using the correct data type for the column?