Page 1 of 1

hesk 2.3 success encode and decode Simple Chinese(gb2312)

Posted: Wed Feb 29, 2012 2:48 am
by deserteagle369
hesk 2.3 has great features like ticket to KB, support smtp, and etc, I upgraded from 2.2 to 2.3 but the structure change, the visitor use IE with encoding in GB2312 saw wrong code of Chinese ticket and article.

after one week research, I found a solution, the visitor can view and submit Chinese(GB2312 encoding) correctly, the text ind database also display correctly(with phpmyadmin, utf8)

first create database with collation utf8_general_ci, then copy the en fole to cn folder inside language folder.
(you can translate later).

do changes as follow:

1.
D:\wamp\www\hesk\language\cn\text.php
line 10
from

Code: Select all

$hesklang['LANGUAGE']='English';
to

Code: Select all

$hesklang['LANGUAGE']='Simple Chinese';
2.
line 11
from

Code: Select all

$hesklang['ENCODING']='utf8';
to

Code: Select all

$hesklang['ENCODING']='gb2312';
3.
D:\wamp\www\hesk\inc\database.inc.php
line 73

Add new line after line "$hesk_db_link = …"

Code: Select all

mysql_query( "SET NAMES 'gb2312'");
In the backend admin settings panel set the simple Chinese as default language.

that's all. enjoy!

I think this work for all non ascii language. I didn't try.

Re: hesk 2.3 success encode and decode Simple Chinese(gb2312

Posted: Wed Feb 29, 2012 4:22 pm
by Klemen
Thanks for sharing.

Just to add - if you have PHP 5.2.3 or higher and MySQL 5.0.7 or higher the recommended way of doing it is to keep UTF-8 (in the future, utf-8 will be forced by HESK) and add

Code: Select all

mysql_set_charset('utf8',$hesk_db_link);
just above

Code: Select all

if (@mysql_select_db($hesk_settings['db_name'], $hesk_db_link))
in the inc/database.inc.php file.

That should work too.

Re: hesk 2.3 success encode and decode Simple Chinese(gb2312

Posted: Wed Mar 14, 2012 2:13 am
by deserteagle369
My enviremet

php5.3.5

Mysql 5.1.41

You are right, I install a new hesk2.3 to test it, it works but only if the user select page encoding as unicode(utf-8) in browser when submit and loading page everytime.

The autodect in browser can't work correctly, it select western European(ISO), after submit the ticket show correctly(Simple Chinese) but in mysql database it was strange code like this 李博洋

By default, IE6, firefox 3.6.8, opera 11 will autodect the hesk page as western not unicode

If I select utf-8 and submit ticket in Simple Chinese, then view the ticket by manually select page encoding as utf-8, it is okay, so does the Simple Chinese in mysql database. But it's no good for user to select page encoding for every page loading.

So, if the autodect can work, that will be great.

thanks.

eagle

Re: hesk 2.3 success encode and decode Simple Chinese(gb2312

Posted: Wed Mar 14, 2012 8:37 am
by Klemen
Change your encoding in text.php to

Code: Select all

$hesklang['ENCODING']='utf8';
and the browser should auto-detect as UTF-8

Re: hesk 2.3 success encode and decode Simple Chinese(gb2312

Posted: Thu Mar 15, 2012 1:04 am
by deserteagle369
I changed 'utf8' to 'utf-8', it work!

Code: Select all

$hesklang['ENCODING']='utf-8';
thanks

ealge