Problem:

MigrateSourceMSSQL class does not support "CharacterSet" key in the configuration array. The migration is not able to import data containing any multibyte characters.

Function sqlsrv_fetch_object() returns false for such rows with multibyte characters.

The migration does not process all rows from SQL queries and gives no explanation of why some rows are unprocessed.

Solution:

- Extend $connectionInfo array with "CharacterSet" key.
- Add 'character_set' => "UTF-8" to the database configuration array.

A patch is attached.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

martin_klima created an issue. See original summary.

martin_klima’s picture

Issue summary: View changes
martin_klima’s picture

martin_klima’s picture

Issue summary: View changes
martin_klima’s picture

Status: Active » Needs review
klausi’s picture

Status: Needs review » Needs work
+++ b/plugins/sources/sqlsrv.inc
@@ -95,7 +96,7 @@ class MigrateSourceMSSQL extends MigrateSource {
+      $connectionInfo = array( "Database"=>$this->configuration['database'], "UID"=>$this->configuration['username'], "PWD"=>$this->configuration['password'], "CharacterSet"=>$this->configuration['character_set']);

you say in the docs that this new parameter is optional, but you don't check it with isset() here?

This will cause PHP warnings when people upgrade the module, we should check the character_set key before adding it to the $connectionInfo.

And can you split this over multiple lines? Very hard to read in this long line.

martin_klima’s picture

Status: Needs work » Needs review
FileSize
1.29 KB
976 bytes

Thank you for your review @klausi. I fixed the issue.

klausi’s picture

Status: Needs review » Reviewed & tested by the community

Looks good, thanks!

pifagor’s picture

  • pifagor committed 8daa1f9 on 7.x-2.x authored by martin_klima
    Issue #3097408 by martin_klima, klausi, pifagor: UTF-8 support: Add...
pifagor’s picture

Status: Reviewed & tested by the community » Fixed

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.

joseph.olstad’s picture