re: mssql and latin characters
| From: | Cary Clark | Date: | Tue, 22 Jan 2008 23:28:36 +0000 |
| Subject: | re: mssql and latin characters | ||
| Groups: | php.i18n | ||
| Request: | Send a blank email to php-i18n+get-1150@lists.php.net to get a copy of this message | ||
Windows and Unix platforms use different Latin-1 character set encodings that are not entirely compatible. Windows uses "windows-1252" (also referred to as "cp1252" by some platforms) and Unix systems typically use the "iso-8859-1" character set. The first thing I would try is changing your PHP code to this:
<?php
mssql_connect('server','user','pass');
mssql_select_db('db');
$r = mssql_query(“set names cp1252”);
$r = mssql_query(“select some_column from some_table”);
$d = mssql_fetch_assoc($r);
echo $d['some_column'];
?>
The "set names <charset>" query tells the MySQL server that you want to send and receive data to/from the server in the cp1252 (windows-1252) encoding instead of its default encoding (which again is probably iso-8859-1). Hopefully this will solve your problem.
Regards,
Cary Clark