What is my best option for converting my phpbb2 latin1 DB to a phpbb3 utf8 DB?
I am upgrading a phpBB 2.x forum to phpBB 3.x and I'm trying to figure out what the best option is for converting to utf8 from the previous latin1 encoding. Right now I'm still just working on my phpBB2 database dump file. I used sed to update the CHARSET and SET NAMES statements in the dump file and then tried running it through iconv:
开发者_运维百科cat phpbb2.sql | sed 's/SET NAMES latin1/SET NAMES utf8/g' > tmp
mv tmp phpbb2_utf8.sql
cat phpbb2_utf8.sql | sed 's/CHARSET=latin1/CHARSET=utf8/g' > tmp
mv tmp phpbb2_utf8.sql
iconv -f latin1 -t utf8 phpbb2_utf8.sql > phpbb2_utf8_iconv.sql
This is no good. All sorts of garbage. Do you think I should just use latin1 on the new phpBB3 installation?
- Export phpBB2 database to the plain .sql file.
- Change encoding of that file from latain1 to Unicode UTF-8 (
iconv
). - Change all occurrences of
DEFAULT CHARACTER SET
,SET NAMES
etc. fromlatain1
toutf8
. - Change all occurrences of
COLLATION
/COLLATE
fromlatain1_*_ci
toutf8_unciode_ci
- Run phpBB2 to phpBB3 converter.
There isn't any need to do this. The phpBB2 to phpBB3 converter will import data from the latin1 encoded tables and store it utf8 encoded in the new tables.
精彩评论