Textpattern CMS support forum
You are not logged in. Register | Login | Help
- Topics: Active | Unanswered
#1 2006-01-26 16:56:26
- alannie
- Member
- From: Minnesota, USA
- Registered: 2005-09-15
- Posts: 150
charset woes, configure local server to match remote server
Hello, I have been having utf-8 vs latin-1 problems for a while now. I installed MySQL on my Mac OS X machine so I could use it for development and then upload changes to my web host. I’ve got MySQL v4.1.16 installed, while my web host has v4.1.15.
When I install TXP on my web host account, the config.php shows latin1 as the charset. On my server, it shows utf8 as the charset. Consequently, when I try to import data from my web host into my local database, special characters get mangled.
The only way I’ve been able to get around this (after much futzing around) is to manually change my local config.php to latin1 and specify latin1 whenever I import a dump from the remote via phpMyAdmin, but this makes me nervous. What do I need to change in order for TXP to automatically select latin1 when I install it on my local setup?
I wouldn’t be surprised if I’ve royally mangled things, so here’s the diagnostics from both setups.
Remote server (MySQL v4.1.15, TXP 4.0.3):
<code>Charset (default/config): latin1/latin1
character_set_client: latin1
character_set_connection: latin1
character_set_database: latin1
character_set_results: latin1
character_set_server: latin1
character_set_system: utf8
character_sets_dir: /usr/local/share/mysql/charsets/
18 Tables: txp_section is utf8, txp_users is utf8</code>
Local server (MySQL v4.1.16, TXP 4.0.3):
<code>Charset (default/config): latin1/latin1
character_set_client: latin1
character_set_connection: latin1
character_set_database: latin1
character_set_results: latin1
character_set_server: latin1
character_set_system: utf8
character_sets_dir: /usr/local/mysql-standard-4.1.16-apple-darwin7.9.0-powerpc/share/mysql/charsets/
18 Tables: txp_section is utf8, txp_users is utf8</code>
I would be deeply grateful to anyone who can help me fix my local setup so that it’s correct from the very beginning.
Offline
Re: charset woes, configure local server to match remote server
Hi alannie,
maybe, this can help you:
http://textsnippets.com/posts/show/84
As far as I understand encodings and TXP, you should try to keep everything in UTF8, because TXP can handle that…
So, you should try to convert your database in the remote server (look at the link I gave you).
BTW, if you understand spanish, you can read this article about UTF8 by Kusor (Pedro Palazón). He is one of our great TXP developers…
In the article, there are some links to english resources that may help you
Offline
Re: charset woes, configure local server to match remote server
I think you are partly misreading dignostics. Read this:
http://textpattern.net/wiki/index.php?title=Unicode_Support#Diagnostics
Both setups are “compatible”, there’s no problem at all between importing between the two.
Your only problem is this: “txp_section is utf8, txp_users is utf8”. It seem those two tables were imported from a different etup, and those two tables are the only ones you may have to worry about. So if you are going to try changing stuff, only play with those two tables, and leave the rest as is (or alternatively, change all the other ones, but leave those two alone).
What do I need to change in order for TXP to automatically select latin1 when I install it on my local setup?
Textpattern selects the best possible option, and that is utf8 where possible (= fresh installs on mysql4.1 and up).
- If you want to replicate a server environment, then you should use the same versions of mysql on your test-setup.
- If you want to replicate an already existing site, simply use the old config.php and dump/import the old database.
Does that help?
Offline
#4 2006-01-30 17:10:35
- alannie
- Member
- From: Minnesota, USA
- Registered: 2005-09-15
- Posts: 150
Re: charset woes, configure local server to match remote server
Thank you maniqui and Sencer. I was able to set up another database on the remote server with a fresh install of TXP that automatically selected utf8. Then I used the info in manqui’s textsnippets article to convert my existing database to utf8. I still found that I needed to be sure that I imported the db dump as a file with “utf-8” selected in phpMyAdmin. A copy/paste of the dump made the special characters go wacky.
Offline