OJS OCS OMP OHS

You are viewing the PKP Support Forum | PKP Home Wiki



connection_charset error

Are you responsible for making OCS work -- installing, upgrading, migrating or troubleshooting? Do you think you've found a bug? Post in this forum.

Moderators: jmacgreg, michael, John

Forum rules
What to do if you have a technical problem with OCS:

1. Search the forum. You can do this from the Advanced Search Page or from our Google Custom Search, which will search the entire PKP site. If you are encountering an error, we especially recommend searching the forum for said error.

2. Check the FAQ to see if your question or error has already been resolved. Please note that this FAQ is OJS-centric, but most issues are applicable to both platforms.

3. Post a question, but please, only after trying the above two solutions. If it's a workflow or usability question you should probably post to the OCS Conference Support and Discussion subforum; if you have a development question, try the OCS Development subforum.

connection_charset error

Postby mendesrocha » Sun May 18, 2008 11:10 pm

Hello,

I have the following trouble using the OCS. We made the instalation and everything looks OK, but not the connection character setting with our database.

Our database charset is UTF-8. The collation is setted to latin_general_ci.

Do you that that difference could be the problem?

The following values are set up in our config.inc.php file

i18n
Code: Select all
locale  pt_BR
client_charset    utf-8
connection_charset    On
database_charset    On


But, when we insert data with characters using the UTF-8 code, the database does not register these data with the utf-8.

For instance, we write "Ciências da Informação" and the system saves "Ciencia da Informacao"

How can we solve this problem?

The informations of our system are:

OS platform Linux
PHP version 5.2.4
Apache version Apache
Database driver mysql
Database server version 5.0.51-locaweb-log

Thanks for your attention,
Renato
mendesrocha
 
Posts: 169
Joined: Mon Nov 05, 2007 11:10 am
Location: Brazil

Re: connection_charset error

Postby mj » Wed May 21, 2008 7:28 am

Hi Renato,

There are a couple of issues that may be causing this:

1) Judging by the fact that your database is automatically converting UTF-8 characters to Latin-1 characters, I suspect the issue is your database collation. The easiest way to do this is by issuing:

Code: Select all
ALTER DATABASE `mydatabase` DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci


Similarly, if your tables are in latin_general_ci, you will have to change them to UTF-8 as well by running this for each of your tables:

Code: Select all
ALTER TABLE `table_name` CONVERT TO CHARACTER SET utf8 COLLATE utf8_unicode_ci;


2) If the above doesn't resolve your issue, then it may be a bug that was in OCS 2.0.0 itself (which will be resolved in the upcoming OCS 2.1). There is a full discussion thread at http://pkp.sfu.ca/support/forum/viewtopic.php?f=3&t=2573&p=10998, but you can get the patch to correct it directly at http://pkp.sfu.ca/bugzilla/attachment.cgi?id=452.

Hope this helps,
MJ
mj
Site Admin
 
Posts: 304
Joined: Fri Mar 26, 2004 9:32 am
Location: Toronto, Canada

Re: connection_charset error

Postby mendesrocha » Wed May 21, 2008 1:10 pm

Hi MJ,

Thanks a lot for your attention.

Part of the problem was indeed with the collation of mysql. I drop all the tables, and set up the new installation, now with the collation set to "utf8_unicode_ci"

I have done a new OCS Instalattion and everythings looked fine, but when I tried do login, i received the following message:

Code: Select all
DB Error: Duplicate entry 'i7b6fdv5ob0f40m9nudvt5cro5' for key 1


I found out some issues on this forum about this error. I enabled the debug and the Stack Trace, and the result is:

For the debug:
Code: Select all
(mysql): SET NAMES 'utf8'   (mysql): INSERT INTO sessions (session_id, ip_address, user_agent, created, last_used, remember, data) VALUES ('i7b6fdv5ob0f40m9nudvt5cro5', '189.5.110.255', 'Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.8.1.13) Gecko/20080325 Ubuntu/7.10 (gutsy) Firefox/2.0.0.13', 1211400398, 1211400398, 0, '')   1062: Duplicate entry 'i7b6fdv5ob0f40m9nudvt5cro5' for key 1

                     ADOConnection._Execute(INSERT INTO sessions
            (session_id, ip_address, user_agent, created, last_used, remember, data)
            VALUES
            ('i7b6fdv5ob0f4...) % line  845, file: adodb.inc.php
                  ADOConnection.Execute(INSERT INTO sessions
            (session_id, ip_address, user_agent, created, last_used, remember, data)
            VALUES
            (?, ?, ?, ?, ?,..., Array[7]) % line  186, file: DAO.inc.php
               DAO.update(INSERT INTO sessions
            (session_id, ip_address, user_agent, created, last_used, remember, data)
            VALUES
            (?, ?, ?, ?, ?,..., Array[7]) % line   79, file: SessionDAO.inc.php
            SessionDAO.insertSession(Object:Session) % line   78, file: SessionManager.inc.php
         SessionManager.SessionManager(Object:SessionDAO) % line  105, file: SessionManager.inc.php


And for the Stack Trace
Code: Select all
File: /home/cbce/public_html/congressos/classes/session/SessionDAO.inc.php line 79
Function: DAO->update("INSERT INTO sessions (session_id, ip_address, user_agent, cr...", Array(7))

File: /home/cbce/public_html/congressos/classes/session/SessionManager.inc.php line 78
Function: SessionDAO->insertSession(Object(Session))

File: /home/cbce/public_html/congressos/classes/session/SessionManager.inc.php line 105
Function: SessionManager->SessionManager(Object(SessionDAO))

File: /home/cbce/public_html/congressos/classes/i18n/Locale.inc.php line 153
Function: SessionManager::getManager()

File: /home/cbce/public_html/congressos/classes/i18n/Locale.inc.php line 103
Function: Locale::getLocale()

File: /home/cbce/public_html/congressos/includes/driver.inc.php line 93
Function: Locale::initialize()

File: /home/cbce/public_html/congressos/index.php line 55
Function: require("/home/cbce/public_html/congressos/includes/driver.inc.php")


I have also tried to apply the following patch, and I find another error:

Code: Select all
 patch -p1 < OCS-2_0_0-1_Charset_Patch_r2.txt
patching file classes/form/Form.inc.php
patch: **** malformed patch at line 43: Index: classes/core/Core.inc.php


I will appreciate a lot anyhelp on these issues!

Thanks again

Renato
mendesrocha
 
Posts: 169
Joined: Mon Nov 05, 2007 11:10 am
Location: Brazil

Re: connection_charset error

Postby mj » Wed May 28, 2008 11:08 am

Hi Renato,

This issue sounds like you already have data in your database. If you're doing a fresh installation, I would suggest you completely drop and re-create the tables in utf8_unicode_ci as you have, and use the new OCS 2.1 which was released on Friday. It has much improved character handling, as well as numerous other features. By starting with a fresh database, you shouldn't receive any "Duplicate key" errors.

MJ
mj
Site Admin
 
Posts: 304
Joined: Fri Mar 26, 2004 9:32 am
Location: Toronto, Canada


Return to OCS Technical Support

Who is online

Users browsing this forum: Bing [Bot] and 1 guest