Menü schliessen
Created: July 11th 2016
Last updated: May 1st 2020
Categories: Databases,  MySQL
Author: Marcus Fleuti

Howto convert a MySQL/MariaDB database from any charset into UTF-8 - with Notepad++ in Windows

Donation Section: Background
Monero Badge: QR-Code
Monero Badge: Logo Icon Donate with Monero Badge: Logo Text
82uymVXLkvVbB4c4JpTd1tYm1yj1cKPKR2wqmw3XF8YXKTmY7JrTriP4pVwp2EJYBnCFdXhLq4zfFA6ic7VAWCFX5wfQbCC

The goal

This blog article is about converting a MySQL (MariaDB) database to UTF-8 properly. You need to have a database dump file ready for this. Please read this article if you need to know how this can be achieved: Create a MySQL-Dump (Backup) in Windows with mysqldump.exe

Howto

  • Download Notepad++: https://notepad-plus-plus.org/download/
  • Open DB within Notepad++
  • Go to menu "Coding" and select "UTF-8 without BOM"
  • Save and Close
  • Re-Open the DB file within Notepad++ and check if coding has been properly applied. If not something has failed and you should try another conversion tool like "UTF Cast Pro" (https://www.rotatingscrew.com/utfcast-professional.aspx)
  • While in Notepad++: Press CTRL+H (search + replace)
  • Check that search is NOT case sensitive
  • Set "Search mode" to "regular expression" and check the checkbox "find \r and \n"
  • Enter the following search term: DEFAULT CHARSET\=.*$
  • Enter the following term in the replace field: DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; (Attention: Copy the ";" too)
  • Search/Replace all
    notepad++-search-replace-mysql-utf8-convert-charset

Related articles: