title: Encoding SQL_Latin1_General_CP1_CI_AS into UTF-8
body: <p>I'm generating a XML file with PHP using DomDocument and I need to handle asian characters. I'm pulling data from the MSSQL2008 server using the pdo_mssql driver and I apply utf8_encode() on the XML attribute values. Everything works fine as long as there's no special characters.</p>
  
  <p>The server is MS SQL Server 2008 SP3</p>
  
  <p>The database, table and column collation are all SQL_Latin1_General_CP1_CI_AS</p>
  
  <p>I'm using PHP 5.2.17</p>
  
  <p>Here's my PDO object:</p>
  
  <pre><code>$pdo = new PDO("mssql:host=MyServer,1433;dbname=MyDatabase", user123, password123);
  </code></pre>
  
  <p>My query is a basic SELECT.</p>
  
  <p>I know storing special characters into SQL_Latin1_General_CP1_CI_AS columns isn't great, but ideally it would be nice to make it work without changing it, because other non-PHP programs already use that column and it works fine. In SQL Server Management Studio I can see the asian characters correctly.</p>
  
  <p>Considering all the details above, how should I process the data?</p>