XF 1.1 weird characters after import

Hey Guys,

I've moved my xenforo installation over to a new web host and have some issues with encoding i believe. For instance apostrophies now show up like: "’" and pound signs show up as "£" etc..

How can i fix this?



Jake Bunce

XenForo moderator
Staff member
Yep. This is clearly a character encoding issue. Since the source is already UTF8 this thread might help:


He modified this file:


And changed this code:

	 * Convert the given text to valid UTF-8
	 * @param string $string
	 * @param boolean $entities Convert &lt; (and other) entities back to < characters
	 * @return string
	protected function _convertToUtf8($string, $entities = null)
		// note: assumes charset is ascii compatible
		if (preg_match('/[\x80-\xff]/', $string))
			if (function_exists('iconv'))
				$string = @iconv($this->_charset, 'utf-8//IGNORE', $string);
			else if (function_exists('mb_convert_encoding'))
				$string = mb_convert_encoding($string, 'utf-8', $this->_charset);

		$string = utf8_unhtml($string, $entities);

		return preg_replace('/[\xF0-\xF7].../', '', $string);


XenForo moderator
Staff member
It sounds as if the characters were corrupted during the export/import from the old to new host.

You would have to use SQL queries to replace any existing content in the database.

Unless you can redo the export/import.


XenForo developer
Staff member
If it happened when moving servers, then it happened at one of three places:
  1. When the data was dumped. Should be unlikely, but depends on the method.
  2. During the transport. If the file was edited by someone, it could have been changed from UTF-8 to a Latin-1 style version, which would have this behavior.
  3. During the restore. Again, possible, particularly if done via a web interface rather than the command line.
I'd recommend redoing the dump (via mysqldump if possible) and retrying the restore via mysql at the command line. You may need your host to help.