I am writing a PHP script to import data into a MYSQL database from a Microsoft SQL Server 2008 database.
The MSSQL server is installed with the convolution "SQL_Latin1_General_CP1_CI_AS", and the data in question is stored in a column of the type "nchar".
PHP is used in my web pages
<meta http-equiv="content-type" content="text/html; charset=utf-8">
to indicate that they should be displayed with UTF-8 character encoding.
I am retrieving data from an MSSQL database using the PHP sqlsrv extension.
$sql = 'SELECT * FROM [tArticle] WHERE [ID] = 6429'; $stmt = &sqlsrv_query($dbHandler, $sql); while ($row = sqlsrv_fetch_object($stmt)) {
Forget about entering data into the MYSQL database. I cannot correctly display a string on my PHP page. From the examples on my list:
echo $row->Text1
displayed by my browser as a clearly invalid character: "Lucy s"
all examples following that they appear as spaces: "Lucy"
It seems like a character set mismatch problem for me, but how can I get this data to display correctly from the MS SQL database (without changing my encoding on the web page)? If I can figure this out, I can probably handle storing it in the MYSQL database part.
php sql-server character-encoding
rushinge
source share