xoops forums

kevcar

Not too shy to talk
Posted on: 2008/8/2 14:51
kevcar
kevcar (Show more)
Not too shy to talk
Posts: 127
Since: 2007/6/2 1
#1

How do I change charset=UTF-8

I have updated to XOOPS 2.3 and it installed
charset=UTF-8 and I now have ? symbols on my website, I live in the UK so what Charset should I be using and how do I change it?

DarinAllan

Friend of XOOPS
Posted on: 2008/8/2 16:52
DarinAllan
DarinAllan (Show more)
Friend of XOOPS
Posts: 477
Since: 2005/5/18
#2

Re: How do I change charset=UTF-8

I thought I saw a post by Mamba that suggested it could be a browser problem, but I can't find the post so I could be wrong.

I use Firefox 3 on Linux so this may not be exactly the same.

If you are using Firefox go to View >>> Character Encoding >>> UTF-8

I was having this same problem but it seemed to fix itself with an upgrade I think or maybe I adjusted the browser lol, I just can't remember, but I do have FF3 set to UTF-8.

If you use Internet Exploder I don't know that at all. ;o)

trabis

Core Developer
Posted on: 2008/8/2 18:47
trabis
trabis (Show more)
Core Developer
Posts: 2268
Since: 2006/9/1 1
#3

Re: How do I change charset=UTF-8

Update your system module,

If it does not work then Try edit mainfile and replace utf by latin1.

Close your site, don´t submit new content until you resolve this issue, after making changes try submit content with special characters like á ç etc and see if how they are being recorded in the database.

I still not get it you know. This collation stuff. I see people releasing language files with utf-8 full of weird stuff that only a machine can read, does not make sense for me. I will keep my latin and my dear ISO in my language files so I can see things as the are in database and files.

kevcar

Not too shy to talk
Posted on: 2008/8/2 19:23
kevcar
kevcar (Show more)
Not too shy to talk
Posts: 127
Since: 2007/6/2 1
#4

Re: How do I change charset=UTF-8

Thanks for the info.

all I can find on the mainfile about charset is this:

// Set the database charset if applicable
if (defined("XOOPS_DB_CHARSET")) die();
define( 'XOOPS_DB_CHARSET', '' );

trabis

Core Developer
Posted on: 2008/8/2 20:34
trabis
trabis (Show more)
Core Developer
Posts: 2268
Since: 2006/9/1 1
#5

Re: How do I change charset=UTF-8

I supose you have to add utf8 inside it

// Set the database charset if applicable
if (defined("XOOPS_DB_CHARSET")) die();
define( 'XOOPS_DB_CHARSET', 'utf8' );

kevcar

Not too shy to talk
Posted on: 2008/8/2 20:52
kevcar
kevcar (Show more)
Not too shy to talk
Posts: 127
Since: 2007/6/2 1
#6

Re: How do I change charset=UTF-8

I try that out, thanks for that

Kevin

What a nightmare

anderssk

Quite a regular
Posted on: 2008/8/5 17:40
anderssk
anderssk (Show more)
Quite a regular
Posts: 335
Since: 2006/3/21
#7

Re: How do I change charset=UTF-8

Maybe this should be a FAQ, because I belive many users will have this experience when upgrading to 2.3.0

I do not think the right solution is to go back to ISO encoding. The solution must be to re-encode language-files from ISO to UTF-8.
Maybe because I'm from Denmark and we have some special characters.

I'm using Notepad++

Open Your language-files and select Format -> convert to UTF-8 (without BOM)
Save the file again.

Then the encoding are correct.

kevcar

Not too shy to talk
Posted on: 2008/8/5 17:50
kevcar
kevcar (Show more)
Not too shy to talk
Posts: 127
Since: 2007/6/2 1
#8

Re: How do I change charset=UTF-8

Thanks for that

ghia

Community Support Member
Posted on: 2008/8/8 0:54
ghia
ghia (Show more)
Community Support Member
Posts: 4954
Since: 2008/7/3 1
#9

Re: How do I change charset=UTF-8

It is not only a question of language files.

It is also affecting the SQL files used at module install.
I'm evaluating Xoops 2.3.0rc and ran in the following problem:
When installing formulaire, the fields in the example form where truncated to the first accented character.
This was because the install routine of the XOOPS system proposed UTF-8. I deleted the database and did the install again this time with latin1 and latin1_general_ci. Now the tables and the database where recreated and had the correct encoding to receive these kind of SQL. Hereafter the install of the formulaire module gave complete and correct fields for the accented characters in the database. However in the display of the browser (FF 3.0.1 and also IE6) the accented characters where replaced by blockimages.
The cause of this was the english language selection, where in /language/global.php the '_CHARSET' was defined to 'UTF-8'.
The header of the html page identified also the character encoding as UTF-8.
Apparently there was no conversion done from the database character set to the html output character set.

Installing and switching to the dutch language (my sites default) where '_CHARSET' is defined as 'ISO-8859-1' let correctly appear the accented characters.

While eastern languages may need / benefit from UTF-8, it seems to me that European languages are more advantagous to use latin1.

Maybe there should be an explication note added to the selection box in the XOOPS install procedure that points out these things.

anderssk

Quite a regular
Posted on: 2008/8/8 15:09
anderssk
anderssk (Show more)
Quite a regular
Posts: 335
Since: 2006/3/21
#10

Re: How do I change charset=UTF-8

If you change to latin1 in global.php and in MySQL You run with ISO encoding.
Thats a big way around instead of re-encode formulaire's language files.
If you run the installation with UTF and uses Formulaire with english language, You don't have any problems?