Partial fix Importing Profile Fields


Well-known member
vb table profilefield, field data has collation of latin1_swedish_ci.

If using non-latin letters in the field, unserialize will generate a php error.

And fail to import the profile fields.

Sample data listed:



XenForo developer
Staff member
Generally this indicates that the data itself was corrupted, or you haven't fully mimic'd the collation setup you had in vBulletin (specifically the connection character set). If your data is getting converted from latin1 to utf8 by MySQL due to the connection character set, that will break things.

That said, I have suppressed this error like in private messages, but I suspect your issue is down to the connection character set. (Which should probably be forced to latin1)


Well-known member
The database has been moved from multiple servers. The current connection uses utf8 to better support multiple languages. Originally, before my time. it was on latin1. Unserialize doesn't handle mixed charsets well.

Since the destination field is utf8, maybe a solution could be the following:

protected function _convertUserFieldChoices(array $profileField, array &$fieldChoiceLookups)
        $choices = array();
        $profileField['data'] = $this->_convertToUtf8($profileField['data']);

        foreach (unserialize($profileField['data']) AS $key => $choice)
            // $choice = $this->_convertToUtf8($choice);  // save dozens of fx calls that we don't need.
            $choiceId = XenForo_Helper_String::wholeWordTrim($choice, 23, 0, '');


Well-known member
If anyone else runs into data conversion issues when importing into XF from another forum, I wrote a more complete conversion function. Send me a message and I can email the functions to you, since it most likely has limited appeal to most forum owners here.

The function will improve the import speed by minimizing function calls and isn't reliant on having the mb_detect_encoding function available. Additionally you can tailor it to your specific forum needs.