Convert a Latin1 Database to UTF-8
After some unsuccessful attempts to convert a Latin1 database to UTF-8 using existing scripts, I finally wrote my own script to do it. Most existing scripts did the conversion but required you to drop indexes manually and often lost comments and some field characteristics (e.g. NOT NULL, UNIQUE, DEFAULT). This script drops and adds the indexes automatically and preserves the field information (including compound-key indexes).
The script should now work with the MODx Revolution database as well as those of older versions.
The script is called cdc.php (for Convert Database Charset). You can download the executable script and the readme.txt file here: cdc.zip.
Note that this is not a snippet. It is meant to run outside of MODx (or any other CMS). It will convert any character set/collation to any other character set.collation.
See the readme.txt file in the .ZIP package for more information and instructions for converting the database of a live site.
My book, MODX: The Official Guide is now available for order here. The book is currently being shipped.
If you have the book and would like to download the code, you can find it here.
If you have the book and would like to see the updates and corrections page, you can find it here.
MODX: The Official Guide is 772 pages long and goes far beyond this web site in explaining beginning and advanced MODX techniques. It includes detailed information on:
- Installing MODX
- How MODX Works
- Working with MODX resources and Elements
- Using Git with MODX
- Using common MODX add-on components like SPForm, Login, getResources, and FormIt
- MODX security Permissions
- Customizing the MODX Manager
- Using Form Customization
- Creating Transport Packages
- MODX and xPDO object methods
- MODX System Events
- Using PHP with MODX
Go here for more information about the book.
Thank you for visiting BobsGuides.com
— Bob Ray
Bread
