Fixed Import Threads from VB - A server error occurred. Please try again later.


Hi there,
I try import threads after import users but got an error:
Mysqli statement execute error : Incorrect string value: '\xF0\xB6\xA2\xBDuW...' for column 'message' at row 1

   1. Zend_Db_Statement_Mysqli->_execute() in C:\xampplite\htdocs\dev\xen\vibe\library\Zend\Db\Statement.php at line 292
   2. Zend_Db_Statement->execute() in C:\xampplite\htdocs\dev\xen\vibe\library\Zend\Db\Adapter\Abstract.php at line 468
   3. Zend_Db_Adapter_Abstract->query() in C:\xampplite\htdocs\dev\xen\vibe\library\Zend\Db\Adapter\Abstract.php at line 546
   4. Zend_Db_Adapter_Abstract->insert() in C:\xampplite\htdocs\dev\xen\vibe\library\XenForo\DataWriter.php at line 1490
   5. XenForo_DataWriter->_insert() in C:\xampplite\htdocs\dev\xen\vibe\library\XenForo\DataWriter.php at line 1479
   6. XenForo_DataWriter->_save() in C:\xampplite\htdocs\dev\xen\vibe\library\XenForo\DataWriter.php at line 1287
   7. XenForo_DataWriter->save() in C:\xampplite\htdocs\dev\xen\vibe\library\XenForo\Model\Import.php at line 292
   8. XenForo_Model_Import->_importData() in C:\xampplite\htdocs\dev\xen\vibe\library\XenForo\Model\Import.php at line 809
   9. XenForo_Model_Import->importPost() in C:\xampplite\htdocs\dev\xen\vibe\library\XenForo\Importer\vBulletin.php at line 1823
  10. XenForo_Importer_vBulletin->stepThreads() in C:\xampplite\htdocs\dev\xen\vibe\library\XenForo\Importer\Abstract.php at line 77
  11. XenForo_Importer_Abstract->runStep() in C:\xampplite\htdocs\dev\xen\vibe\library\XenForo\ControllerAdmin\Import.php at line 161
  12. XenForo_ControllerAdmin_Import->_runStep() in C:\xampplite\htdocs\dev\xen\vibe\library\XenForo\ControllerAdmin\Import.php at line 105
  13. XenForo_ControllerAdmin_Import->actionImport() in C:\xampplite\htdocs\dev\xen\vibe\library\XenForo\FrontController.php at line 303
  14. XenForo_FrontController->dispatch() in C:\xampplite\htdocs\dev\xen\vibe\library\XenForo\FrontController.php at line 132
  15. XenForo_FrontController->run() in C:\xampplite\htdocs\dev\xen\vibe\admin.php at line 13
My forums run vbulletin 3.8, Threads: 45,511, Posts: 451,636, Members: 148,806
Threads title and content language: vietnamese

Thank you!


Resolved :
Looks like the fix for stripping out 4-byte UTF-8 characters was incorrect (my fault!). I appears to actually be stripping 5 byte UTF-8 characters (with a slight mistake), which aren't actually allowed by the RFC anyway. (As a note, MySQL only supports 3 bytes UTF-8 chars, which represents the BMP.)

To anyone having this issue, try this as a fix. In library/XenForo/Importer/vBulletin.php, change the following line:
return preg_replace('/[\xF8-\xFB].../', '', $string);
return preg_replace('/[\xF0-\xF4].../', '', $string);
This code is effectively the last line in the file. I believe that should prevent/fix this error then.