Author Topic: Setting WB to UTF8  (Read 8722 times)

Offline ruebenwurzel

  • Betatester
  • **
  • Posts: 8364
  • Gender: Male
  • Keep on Rockin
    • Familie Gallas Online
Setting WB to UTF8
« on: January 06, 2012, 05:39:59 PM »
Hello,

i start this thread in the hope that we will end in a working howto convert all WB installations on different server configurations completely to UTF8.

There are different places where you can find UTF8:

1.) The Database Collation
2.) The Database Characterset
3.) The Head-informations of your Template

My goal is to convert all of them to UTF8 and have in the result my pages displayed correctly without wrong characters in the frontend. This means:

1.) Database Collation of all tables and the text- and char-fields have :  utf8_unicode_ci
2.) The Database Characterset is then: utf8
3.) The content of the database is in the way, that it is displayed correct
4.) The charset in advanced WB-Settings is then: Unicode (utf-8)

In most cases the collation of your server is set to "latin1_swedish_ci" and the characterset to "latin1" and in WB the charset to "Unicode (utf-8)" or sometimes in germany to "Iso-8859-1".

I've done the following Steps.
1.) Make a backup of the database
2.) Convert the Content of the database
3.) Change the collation and the characterset of the database
4.) Change charset of WB

1.) Make a backup of the database
Use phpmyadmin to export your database to a .sql file on your local machine

2.) Convert the Content of the database (only needed if your WB-charset is not "Unicode utf-8")
- Make a copy of your database export
- Open this file with a editor (e.g. Notepad++)
- Store this file in "ANSI"
- convert the file to "UTF8 without BOM"
- import the file to your database on the server

3.) Change the collation and the characterset of the database
- rename the attached file from .txt to .php
- adapt the file to the settings for your database (Line 24-27)
Code: [Select]
$mysqlserver = 'localhost' ;     //Host
$mysqluser = 'User';              //User
$mysqlpw = 'Password';         //Password
$mysqldb = 'Database';          //Database
- upload this file to the root of your server
- Call the sript in your browser: http://www.your.domain.com/mysql_change_collation.php
- Delete the script from your server

4.) Change charset of WB (only needed it is not set to "Unicode utf-8")
- go to advanced setting of WB and change the charset to "Unicode (utf-8)"

Now your done and your site should work as before without wrong characters in the frontend.

Disadvantages
WB 2.8.x does not use "set names" to store in the database. This means that all special chars (e.g. "ü") are stored in the database as "ü", but all WB-script can handle this.

In the hope of a good discussion and maybe other better ideas

Matthias

[gelöscht durch Administrator]
« Last Edit: January 06, 2012, 05:59:16 PM by ruebenwurzel »

Offline jdjdjd

  • Posts: 39
Re: Setting WB to UTF8
« Reply #1 on: January 08, 2012, 12:35:02 PM »
I use a news to RSS feed on a number of my sites and often have problems with feeds invalidating with certain characters, usually when a client pastes things like quotation marks etc from a word document. Could converting to UTF8 potentially fix this problem?

Also many thanks for the guide.
« Last Edit: January 08, 2012, 12:36:36 PM by jdjdjd »

Offline Argos

  • Posts: 2542
  • Gender: Male
    • Argos Media
Re: Setting WB to UTF8
« Reply #2 on: January 08, 2012, 01:53:28 PM »
Good post, I'll make it a sticky one.
Jurgen Nijhuis
Argos Media
Heiloo, The Netherlands
----------------------------------------------------------------
Please don't request personal support, use the forums!

Offline noname8

  • Posts: 139
Re: Setting WB to UTF8
« Reply #3 on: April 02, 2012, 07:34:49 AM »
Good topic but this gives errors. Most of the server sql admin is used with phpmyadmin and it just cannot show the standard wb database right. I mean that somehow the phpmyadmin is showing the chars incorrectly.

Offline gearup

  • Posts: 82
Re: Setting WB to UTF8
« Reply #4 on: August 10, 2012, 08:09:29 AM »
Hi,

good post. I thought this may be the reason for a front end Cyrillic character display problem on the intro page but it was not.
http://www.websitebaker2.org/forum/index.php/topic,24412.msg166551.html#msg166551

However I did find out how to check the settings for MySQL database with phpmyadmin3.

I would like to share this as my first thought from reading your post was "how to check my current database settings".

All I needed to do was to log in to the database with phpmyadmin and there I could see the collation and database charset in the following sections;

General Settings: MySQL connection collation utf8_general_ci
MySQL: MySQL charset: UTF-8 Unicode (utf8)
(I did this by first logging into my ISP user area and then logging into the database)

These settings match the ones in your DB collation script so I don't need to change anything there.

Also I saw wb was already set to utf8 in the website admin backend, under settings, show advanced options (as you said too);
Default Settings: Charset: Unicode (utf8)
(wb 2.8.2 rev 1528)

regards,
Tomorrow is a day we can look forward to but will never see.

 

postern-length