I’m in the process of testing a Moodle site upgrade, from version 1.9 to 2.2. On a test box, I created a copy of my Moodle 1.9 site. To get the site to work on the test framework, one of the things I have to do is to update hard-coded URLs to something valid on the test machine. To do so, I use the admin/replace functionality inside Moodle 1.9, i.e.
http://mytestsite/admin/replace.php
In the resulting form, I specify which URLs to switch out. Per the documentation, the script here will then proceed to go through all tables in the Moodle installation and running a script which looks like this:
UPDATE adodb_logsql
SET PARAMS = REPLACE(PARAMS, 'some_url', 'another_url')
The update process seems to work fine. However, it has the following unintended side-effect:
Some of the content in the site, saved in the database, looks like it becomes corrupted during the REPLACE process:
Before: Welcome to Company’s Learning
After : Welcome to Company’s Learning
According to MySQL, the REPLACE statement is multi-byte safe.
My questions:
- What am I doing wrong? A simple
REPLACEshould not have these strange side-effects. - Is there a simple way of undoing the damage?
Test Server:
* IIS 7
* PHP 5.3.13
* MySQL Server 5.5
The true issue here was the data export tool did not add a BOM header to the utf-8 export. During import, the importer parses a few thousand rows to check for encoding, but it never hits the rows that caused a problem, so an incorrect encoding was assumed.