Support » Installing WordPress » convert latin1 to UTF-8

  • I’ve wp 2.3 and the table are latin1. I must convert into UTF-8 and then upgrade to wp 2.6

    I’ve read this:
    http://codex.wordpress.org/Converting_Database_Character_Sets

    but I’ve the problem:”#1283 – Column ‘post_content’ cannot be part of FULLTEXT index “

    this is the query SQL:

    ALTER TABLE wp_4posts_prova CHANGE post_content post_content LONGBLOB NOT NULL ,
    CHANGE post_title post_title BLOB NOT NULL ,
    CHANGE post_excerpt post_excerpt BLOB NOT NULL ,
    CHANGE post_status post_status ENUM( ‘publish’, ‘draft’, ‘private’, ‘static’, ‘object’, ‘attachment’, ‘inherit’, ‘future’, ‘pending’ ) CHARACTER SET utf8 COLLATE utf8_unicode_ci NOT NULL DEFAULT ‘publish’,
    CHANGE comment_status comment_status ENUM( ‘open’, ‘closed’, ‘registered_only’ ) CHARACTER SET utf8 COLLATE utf8_unicode_ci NOT NULL DEFAULT ‘open’,
    CHANGE ping_status ping_status ENUM( ‘open’, ‘closed’ ) CHARACTER SET utf8 COLLATE utf8_unicode_ci NOT NULL DEFAULT ‘open’,
    CHANGE post_password post_password VARBINARY( 20 ) NOT NULL ,
    CHANGE post_name post_name VARBINARY( 200 ) NOT NULL ,
    CHANGE to_ping to_ping BLOB NOT NULL ,
    CHANGE pinged pinged BLOB NOT NULL ,
    CHANGE post_content_filtered post_content_filtered BLOB NOT NULL ,
    CHANGE guid guid VARBINARY( 255 ) NOT NULL ,
    CHANGE post_type post_type VARBINARY( 20 ) NOT NULL DEFAULT ‘post’,
    CHANGE post_mime_type post_mime_type VARBINARY( 100 ) NOT NULL

    any idea?

    thanks

Viewing 8 replies - 1 through 8 (of 8 total)
  • I solved this as follows:

    – Backup the database (phpMyAdmin)
    – Convert the database dump to utf8-unicode (Notepad++)
    – Create new database as utf-8
    – import the dump
    – change settings in wp-congif.php to utf-8

    Thread Starter sdamy

    (@sdamy)

    Hi mbAF!

    Can you help me please?

    – Backup the database (phpMyAdmin)

    Use this export funcion to backup the data base?
    http://www.sculture.biz/images-sd/export-function.jpg

    – Convert the database dump to utf8-unicode (Notepad++)

    Use this menu to convert the database dump to utf8-unicode ?
    http://www.sculture.biz/images-sd/notepadpiu.jpg

    Is correct that in the file of notepad++ leave the word “DEFAULT CHARSET=latin1”?
    http://www.sculture.biz/images-sd/latin1.jpg

    – import the dump
    Have you import the dump with phpmyadmin or shell command?

    At the end is correct this images?
    http://www.sculture.biz/images-sd/before-after.jpg

    thanks and sorry for my english

    > http://www.sculture.biz/images-sd/export-function.jpg
    Looks correct.

    > http://www.sculture.biz/images-sd/notepadpiu.jpg
    Use UTF-8 without BOM. BOM is for Windows applications only.

    > http://www.sculture.biz/images-sd/latin1.jpg
    The default charset has to be UTF-8. You have to replace it.

    Amend your wp-config.php for UTF-8 as well. You can upload your dump back in the database with phpMyAdmin. The dump is nothing else like a sql script to create and fill a new database. If you don’t want to drop your old tables (just to be sure) rename the table prefixes in the dump or define a new database if possible. Maybe you have to change the setting in the wp admin interface to utf-8 afer the import as well.

    To let your blog work with utf-8 only, you have to definde utf-8 as the page charset in your theme as well (header.php). Otherwise the browser will interpret the utf-8 (database query-results) as latin. If you have created/converted a file of your theme to utf-8 (ansi without bom, unix) you have to upload the files with your ftp-client as binary. Otherwise the ftp-client will convert the utf-8 back to latin. The only alternative is the encode everything with html-entites like ü --> ü

    > http://www.sculture.biz/images-sd/before-after.jpg
    That’s correct.

    Hope this helps.

    Thread Starter sdamy

    (@sdamy)

    To let your blog work with utf-8 only, you have to definde utf-8 as the page charset in your theme as well (header.php). Otherwise the browser will interpret the utf-8 (database query-results) as latin. If you have created/converted a file of your theme to utf-8 (ansi without bom, unix) you have to upload the files with your ftp-client as binary. Otherwise the ftp-client will convert the utf-8 back to latin. The only alternative is the encode everything with html-entites like ü –> ü

    It’s this?
    http://www.sculture.biz/images-sd/header-html.jpg

    dear mbAF I’ve follow your steps but in the browser the post contain strange chars 🙁 , for example:

    può (instead of può)
    Curiosità(instead of Curiosità)
    è (instead of è)

    The only solution I see is to replace by hand in notepad all the strange chars (for example replace “è” with “è”) but I’m afraid to make to much mistakes. It’s a possible solution?

    Any idea?

    thanks

    Check first if the wrong chars are in your dump you imported in your database. Then connect with phpMyAdmin against your database and have a look in the “posts” table to see if the chars are correct there.

    If the chars are correct in your database it is just a matter of the wordpress config.

    Thread Starter sdamy

    (@sdamy)

    Dump of actual DB
    charset=latin and if I see this file I watch the strange chars (“ò” instead of “ò”, “Ô instead of “à”).

    phpMyAdmin of actual DB
    If I open record of table “posts” I see the same strange chars (“ò” instead of “ò”, “Ô instead of “à”) as Dump of actual DB.

    What it means?

    thanks mbAF

    Hmm, connect with phpMyAdmin against your actual DB and have a look in the posts table. If you see the wrong chars already there, they are stored incorrectly in your DB. This can happen if your DB is still set to latin and your wordpress is set to utf-8. So you can’t convert anything correctly and the only solution will be to search and replace the characters one by another before import the dump.

    Thread Starter sdamy

    (@sdamy)

    At the end I’ve search and replace the characters by hand with notepad++

    Thank you very much for taking the trouble to help me.

Viewing 8 replies - 1 through 8 (of 8 total)
  • The topic ‘convert latin1 to UTF-8’ is closed to new replies.