I have converted a MySQL 4.0 database (which also had no notion of character encoding yet) to MySQL 5.0 four years ago, so BTDT.
But first of all, there is no "ANSI" character encoding; that is a misconception and a misnomer that has caught on from the early versions of Windows (there are ANSI escape sequences, but they have nothing to do with character encoding). You are most certainly looking at Windows‑1252-encoded text. You should convert that text to UTF‑8 as then you have the best chance of keeping all used characters intact (UTF‑8 is a Unicode encoding, and Unicode contains all characters that can be encoded with Windows-125x, but at different code points).
I had used both the iconv
and recode
programs (on the Debian GNU/Linux system that the MySQL server ran on) to convert Windows‑1252-encoded text of a MySQL export (created by phpMyAdmin) to UTF‑8. Use whatever program or combination of programs works best for you.
As to your questions:
- You can try, but it might not work. In particular, you might have trouble opening a large database dump with Notepad++ or another text editor.
- Depends.
ALTER TABLE … CONVERT TO …
does more than just converting encodings.
- See the paragraph above.
- Yes. You should set the character encoding of every table and every text field that you are importing data into, to
utf8
(use whatever utf8_…
collation fits your purpose or data best). ALTER TABLE … CONVERT TO …
does that. (But see 2.)
- I don't think
MYSQL323
matters here, as your export would contain only CREATE
, INSERT
and ALTER
statements. But check the manual first (the "?" icon next to the setting in phpMyAdmin). latin1
means "Windows-1252" in MySQL 5.0, so that might work and you must skip the manual conversion of the import then.
- I don't think so; PHP is not yet Unicode-aware. What matters is how the data is processed by the PHP script. Usually the
Content-Type
header field for your generated text resources using that data should end with ; charset=UTF-8
.
On an additional note, you should not be using MySQL 5.0.x anymore. The current stable version is MySQL 5.5.18. "Per the MySQL Support Lifecycle policy, active support for MySQL 5.0 ended on December 31, 2009. MySQL 5.0 is now in the Extended support phase." MySQL 5.0.0 Alpha having been released on 2003-12-22, Extended Support is expected to end 8 full years after that, on 2011‑12‑31 (this year).