Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#25 2007-11-28 14:34:58

colak
Admin
From: Cyprus
Registered: 2004-11-20
Posts: 9,093
Website GitHub Mastodon Twitter

Re: rvm_latin1_to_utf8 (v0.5)

Hi ruud… It was the least I could do as you are the one who’s swetting it out on this.

Used v0.3 and all went well.

Since all the tables of the database are now using utf8, is there a way – and would it be prudent – to alter the whole db to utf8?


Yiannis
——————————
NeMe | hblack.art | EMAP | A Sea change | Toolkit of Care
I do my best editing after I click on the submit button.

Offline

#26 2007-11-28 14:58:37

ruud
Developer Emeritus
From: a galaxy far far away
Registered: 2006-06-04
Posts: 5,068
Website

Re: rvm_latin1_to_utf8 (v0.5)

Assuming your database is called ‘colak’, run the following SQL query:

ALTER DATABASE colak CHARSET utf8 COLLATE utf8_general_ci;

From the MySQL documentation:

The database character set and collation are used as default values if the table character set and collation are not specified in CREATE TABLE statements. They have no other purpose.

If you don’t have any non-TXP tables in that database, it won’t hurt changing the charset, but if you plan on having other applications create tables in that database, changing the charset from latin1 to utf8 might have some unexpected results.

I figured that since TXP doesn’t create the database, it should not change it either.

Offline

#27 2007-11-28 16:18:20

colak
Admin
From: Cyprus
Registered: 2004-11-20
Posts: 9,093
Website GitHub Mastodon Twitter

Re: rvm_latin1_to_utf8 (v0.5)

ruud wrote:

If you don’t have any non-TXP tables in that database, it won’t hurt changing the charset, but if you plan on having other applications create tables in that database, changing the charset from latin1 to utf8 might have some unexpected results.

Hmmm… That answers it:) My life is complicated enough for now:)

Last edited by colak (2007-11-28 16:18:49)


Yiannis
——————————
NeMe | hblack.art | EMAP | A Sea change | Toolkit of Care
I do my best editing after I click on the submit button.

Offline

#28 2007-12-02 08:51:32

jstubbs
Member
From: Hong Kong
Registered: 2004-12-13
Posts: 2,395
Website

Re: rvm_latin1_to_utf8 (v0.5)

I have a TXP install on Nicola/TextDrive, which I have to migrate to Prospect on Joyent Open Solaris. I posted about this issue on the Joyent forum.

After following the Joyent Wiki instructions – export the database in Latin1, then change all instances of Latin1 to UTF8, then import to Prospect – I notice the foreign characters are still mangled.

Wet suggested that I try this plugin, and I did, but it made no difference for me. The only other thing I can think of is php.ini setting (UTF-8 on Joyent) or something to do with the database on Nicola.

In the dump from Nicola, the foreign characters look mangled when I open the file in Text Wrangler. Don’t know if that’s normal…

Offline

#29 2007-12-02 10:50:01

ruud
Developer Emeritus
From: a galaxy far far away
Registered: 2006-06-04
Posts: 5,068
Website

Re: rvm_latin1_to_utf8 (v0.5)

My plugin doesn’t change the stored data, just the charset/collation labels on the tables. If the charset/collation is already set to utf-8 and the characters are still mangled then you have a different problem.

If Textdrive offers MySQL 4.1 or higher, you could run my plugin there, then export in utf8 and import in utf8 on the new server (or export/import both in latin1)…. but do make backups before modifying the original database.

Step 5.II in that Joyent migration manual is essentially the same as what my plugin does, only without requiring export/import and manual changes.

Offline

#30 2007-12-02 11:03:15

jstubbs
Member
From: Hong Kong
Registered: 2004-12-13
Posts: 2,395
Website

Re: rvm_latin1_to_utf8 (v0.5)

Hi Ruud,

I really can’t figure it out. Nicola on TextDrive uses MySQL 4.1.22, but when the TXP install was made a couple years back it must have been a lower version.

php.ini default charset on Nicola (the old install) is set to ISO-8859-1, while Joyent’s new servers are all pure UTF-8.

I will try using your plugin on a copy of the DB on Nicola, and report back…

Edit: On Nicola, phpMyAdmin settings are: MySQL charset: UTF-8 Unicode (utf8)
MySQL connection collation: utf8_unicode_ci

Last edited by jstubbs (2007-12-02 11:05:06)

Offline

#31 2007-12-02 11:32:39

jstubbs
Member
From: Hong Kong
Registered: 2004-12-13
Posts: 2,395
Website

Re: rvm_latin1_to_utf8 (v0.5)

Interesting. I just did the following:

1. Created a new DB on Nicola
2. Tried to copy the site DB to the new DB from phpMyAdmin, could not due to error with default charset being set to Latin1 (MySQL 4.1.22 so all new DB’s are UTF-8 by default)
3. Instead exported the site DB, then imported the DB to the test DB. Selected Latin1 as the character set of the file
4. In TXP config.php, changed the site DB to the new test DB. Immediately, I see the foreign characters are mangled!
5. Ran rvm_latin1_to_utf8 plugin
6. Checked, and still see all foreign characters are messed up

After this, I thought I would test the php.ini and config.php settings. I changed config.php dbcharset to UTF8, and php.ini also to UTF-8.

No change. Still messed up.

??!!

Offline

#32 2007-12-02 11:55:25

ruud
Developer Emeritus
From: a galaxy far far away
Registered: 2006-06-04
Posts: 5,068
Website

Re: rvm_latin1_to_utf8 (v0.5)

Can you post the part of the TXP full diagnostics on Nicola that shows the charset information?

Offline

#33 2007-12-02 12:11:12

jstubbs
Member
From: Hong Kong
Registered: 2004-12-13
Posts: 2,395
Website

Re: rvm_latin1_to_utf8 (v0.5)

I’d love to, but I am getting a 500 error on the diagnostics page :-(

Will keep trying.

Offline

#34 2007-12-03 19:35:05

jstubbs
Member
From: Hong Kong
Registered: 2004-12-13
Posts: 2,395
Website

Re: rvm_latin1_to_utf8 (v0.5)

Ruud, I can’t get past a 500 internal server error on the diagnostics page (on Nicola/TextDrive/FreeBSD), so I can’t check the charset for you.

Mamash over at Joyent says its a TXP error that hits the FastCGI limits on TXD – any idea how I can get the diagnostics?

I have a ticket open on TXD, but in the meantime, any help appreciated :-)

Offline

#35 2007-12-03 20:02:42

ruud
Developer Emeritus
From: a galaxy far far away
Registered: 2006-06-04
Posts: 5,068
Website

Re: rvm_latin1_to_utf8 (v0.5)

In PHPmyAdmin, look at the collation/charset of the various text columns in textpattern tables. What does the charset look like there?

What have you set in textpattern/config.php as dbcharset?

Offline

#36 2007-12-03 20:50:46

jstubbs
Member
From: Hong Kong
Registered: 2004-12-13
Posts: 2,395
Website

Re: rvm_latin1_to_utf8 (v0.5)

config.php: $txpcfg[‘dbcharset’] = ‘latin1’;

Nicola MySQL: 4.1.22
MySQL charset: UTF-8 Unicode (utf8)
MySQL connection collation: utf_unicode_ci

All the tables are listed as MyISAM and latin1_swedish_ci

Offline

Board footer

Powered by FluxBB