Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#1 2006-04-01 14:37:32

tassoman
Member
Registered: 2006-03-31
Posts: 13

How to change txp's charset from utf-8 to iso-8859-1

Hi to all.
I’m writing this because I’ve asked some hours ago how to convert my wordpress imported database from iso-8859-1 to utf8, but no one has yet replied my questions.

I think all the new users like me, coming from wordpress, had some doubt about reconvert entire all the db from iso-8859-1 to utf8.
If you import from non utf-8 wordpress, the import script saves entire your new txp articles with funny unwanted chars.

So I found esasier change few rows of php textpad code from utf-8 to iso-8859-1 than change entire my db.

I think the advice developers gave: “use utf-8 because is multilanguage”, still the right and good advice. But for guys coming from wordpress or another cms, i think there isn’t any affordable method to revert a full huge db from iso to utf.

So i suggest to look for “charset=utf-8” (without quotes) in the following php files:

  • textpad/index.php
  • textpad/publish.php
  • textpad/lib/txplib_head.php
  • index.php

and change into “charset=iso-8859-1”. (without quotes)

Remember, is a dirty hack, you’re editing source and next time you’ll upgrade txp you’ll must redo the changes.
(Until someone will write a plugin).

Offline

#2 2006-04-01 15:04:35

Elenita
Member
From: Falls Church, VA
Registered: 2004-05-16
Posts: 407
Website

Re: How to change txp's charset from utf-8 to iso-8859-1

This hack is unnecessary, and may cause problems. The short version is: the encoding of the MySQL database <strong>does not matter</strong>.

Details about Unicode are available at <a href=“http://textpattern.net/wiki/index.php?title=Unicode_Support”>TextBook</a>, including where to find information on converting your tables from latin-1 to UTF-8 if you’d prefer. But again, conversion is an optional step and not necessary for Textpattern to function properly.

Offline

#3 2006-04-01 15:16:28

Sencer
Archived Developer
From: cgn, de
Registered: 2004-03-23
Posts: 1,803
Website

Re: How to change txp's charset from utf-8 to iso-8859-1

You can adapt the import-script to use utf8_encode() on your data. I believe the b2-import script does just that.

Offline

#4 2006-04-02 09:38:08

tassoman
Member
Registered: 2006-03-31
Posts: 13

Re: How to change txp's charset from utf-8 to iso-8859-1

I think utf8_encode parsing should be inserted for each import script, not only b2. This could help spreading the verb of txp and semantic web.

This also could help? :)

http://it.php.net/manual/en/function.iconv.php

Last edited by tassoman (2006-04-02 09:43:13)

Offline

#5 2006-04-02 10:04:18

zem
Developer Emeritus
From: Melbourne, Australia
Registered: 2004-04-08
Posts: 2,579

Re: How to change txp's charset from utf-8 to iso-8859-1

T,

We need sample export and data files to do this sort of thing. Sofar no one has responded to our requests for help; presumably, this means demand is nil.


Alex

Offline

#6 2006-04-02 10:22:31

tassoman
Member
Registered: 2006-03-31
Posts: 13

Re: How to change txp's charset from utf-8 to iso-8859-1

As soon as possible, I’ll try to edit the wordpress import script. Then I’ll publish mine here in the forums.

I think using iconv or some other convert method in the import scripts could be useful for all if in the import form module will be the choice to select previous charset in a select or a text input.

Offline

#7 2006-04-02 17:03:58

tassoman
Member
Registered: 2006-03-31
Posts: 13

Re: How to change txp's charset from utf-8 to iso-8859-1

Ok I’ve posted my corrections into the Troubleshoting forum: http://forum.textpattern.com/viewtopic.php?id=15716

Please visit that topic to continue discussion about charset and wordpress import.

Offline

Board footer

Powered by FluxBB