11
xsell
Re: Converting from latin1 to utf8
  • 2009/12/31 6:07

  • xsell

  • Quite a regular

  • Posts: 245

  • Since: 2008/9/2 1


All did not work , I converted the tabels to utf8 but the data remains ..ugly ?‡???????£?‡?? ?‡???£?‘?????‰ 1

my MySQL is latin1 and when open the backup file it seems the data already utf8 .. so no need to convert the data ..

so i just converted the tabels to utfs and from the MySQL file i replaced the latin1 with utf8 from the file for all the tabels and saved the file and restored it .. then all the data was ok , so i thought it worked .. but when edit the mainfile.php and replace latin1 with utf8 , all messed up .. which means the data still in latin1 regards the tabel collation in utf8 ..

12
SMEDrieben
Converting from latin1 to utf8
  • 2010/1/16 12:00

  • SMEDrieben

  • Not too shy to talk

  • Posts: 173

  • Since: 2009/6/17


I am also trying to convert my system to UTF-8. Unfortunately, not completely succesful.

1) I made a sql-dump in UTF-8 without BOM format.
2) I changed CHARSET=latin1 to CHARSET=utf8 and COLLATE=utf8_general_ci to COLLATE=utf8_unicode_ci
3) I did the database query: ALTER DATABASE DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci
4) I reload my (changed) sql-dump in the database

Then my I went to global.php and mainfile.php to change $langcharset and 'XOOPS_DB_CHARSET' respectively.

If I change those 2 to "utf-8":
- newly entered information is displayed correctly
- special characters (e.g. éëä) from the sql-dump are NOT given correctly: the are shown as small squares.

If I change those 2 (in global.php an mainfile.php) to "utf8_general_ci":
- my old data from the sql-dump are given correctly;
- newly entered data (e.g. in Extcal or News) are terrible.

How can I solve this problem ?

Should I edit the sql-dump more extensively ? By what character should I replace chcracters such as ëäï: they are given in the sql-dump-file (UTF8 without BOM).

Thanks !

Drieben

13
ghia
Re: Converting from latin1 to utf8
  • 2010/1/16 13:00

  • ghia

  • Community Support Member

  • Posts: 4953

  • Since: 2008/7/3 1


I think you must dump in step 1 the database as ansi and then convert your SQL data dump file itself from ansi to UTF-8 without BOM, with eg Notepad++.
In mainfile the correct specification is uft8 and in global UTF-8.

But I'm not sure if this general approach could not disturb binary or array fields.

14
SMEDrieben
Re: Converting from latin1 to utf8
  • 2010/1/16 13:44

  • SMEDrieben

  • Not too shy to talk

  • Posts: 173

  • Since: 2009/6/17


Thanks !

I corrected the specifications in global.php (UTF-8) and mainfile.php (utf8). Thereafter, it works fine !

I didn't even correct my sql-dump: the previous changes were done in Notepad++: according to the program my file was already in UTF-8 without BOM.

SME Drieben

15
SMEDrieben
Re: Converting from latin1 to utf8
  • 2010/1/24 15:00

  • SMEDrieben

  • Not too shy to talk

  • Posts: 173

  • Since: 2009/6/17


I converted my site from latin1 to utf8 (with a sql-dump), the above mentioned ALTER - queries and the changes in global.php and mainfile.php.

The result:
- my site is working perfectly ! All characters are given correctly.
- however, the rss-feeds and generated pdf's are terrible !!

Backend.php, backendt.php (News 1.64), rss.php (Extcal 2.2.2), rss.php (wfdownloads), makepdf (News 1.64) make terrible mistakes with special characters. Characters that are given correctly in my browser, they appear incorrect in the rss-feeds and makepdf !

I studied the php-code of backend.php and backendt.php: the charset is defined as utf-8.

How can I get those characters correct as well ??

SME Drieben

16
ghia
Re: Converting from latin1 to utf8
  • 2010/1/27 1:02

  • ghia

  • Community Support Member

  • Posts: 4953

  • Since: 2008/7/3 1


For News and pdf see this.

Both backend and pdf were written in a time that latin1 and ISO-8859-1 was the norm for websites. These charactersets are asumed by the programs and as for RSS, mosttimes UTF-8 is required, backend converted to it, without wondering if it was already UTF-8 or not.

For the pdf class of News, I think I read on the developers site, that the class was not suitable to put UTF-8 in pdf.

Login

Who's Online

191 user(s) are online (134 user(s) are browsing Support Forums)


Members: 0


Guests: 191


more...

Donat-O-Meter

Stats
Goal: $100.00
Due Date: Nov 30
Gross Amount: $0.00
Net Balance: $0.00
Left to go: $100.00
Make donations with PayPal!

Latest GitHub Commits