Last active
February 2, 2017 09:51
-
-
Save millipedia/9803692 to your computer and use it in GitHub Desktop.
Fix mangled chars in MySQL DB. Original info here http://jonisalonen.com/2010/mysql-character-encoding/
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//general case is: | |
update table set column = convert(binary column using utf8); | |
// if we've just moved a cmsms db then this is a good start | |
// but you'll have to do any module specific bits. | |
update cms_content_props set content = convert(binary content using utf8); | |
update cms_htmlblobs set html = convert(binary html using utf8); | |
update cms_module_news set news_data = convert(binary news_data using utf8); | |
update cms_module_news set summary = convert(binary summary using utf8); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
And this seems to work best of all so far:
Convert to BLOB first and then back to text (or whatever) in UTF8
ALTER TABLE cms_module_QuakersInTheWorld CHANGE qSummary qSummary BLOB;
ALTER TABLE cms_module_QuakersInTheWorld CONVERT TO CHARACTER SET utf8, CHANGE qSummary qSummary TEXT;