hesk 2.3 success encode and decode Simple Chinese(gb2312)

Helpdesk for my helpdesk software

Moderator: mkoch227

Post Reply
deserteagle369
Posts: 94
Joined: Wed Feb 29, 2012 2:00 am

hesk 2.3 success encode and decode Simple Chinese(gb2312)

Post 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.
Last edited by deserteagle369 on Thu Mar 15, 2012 1:05 am, edited 3 times in total.
Eagle
Life is a journey.
Klemen
Site Admin
Posts: 10145
Joined: Fri Feb 11, 2005 4:04 pm

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

Post 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.
Klemen, creator of HESK and PHPJunkyardWas this helpful? You can buy me a drink here Image

Image You should follow me on Twitter here

Help desk software | Cloud help desk | Guestbook | Link manager | Click counter | more PHP Scripts ...

Also browse for php hosting companies, read php books, find php resources and use webmaster tools
deserteagle369
Posts: 94
Joined: Wed Feb 29, 2012 2:00 am

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

Post 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
Eagle
Life is a journey.
Klemen
Site Admin
Posts: 10145
Joined: Fri Feb 11, 2005 4:04 pm

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

Post by Klemen »

Change your encoding in text.php to

Code: Select all

$hesklang['ENCODING']='utf8';
and the browser should auto-detect as UTF-8
Klemen, creator of HESK and PHPJunkyardWas this helpful? You can buy me a drink here Image

Image You should follow me on Twitter here

Help desk software | Cloud help desk | Guestbook | Link manager | Click counter | more PHP Scripts ...

Also browse for php hosting companies, read php books, find php resources and use webmaster tools
deserteagle369
Posts: 94
Joined: Wed Feb 29, 2012 2:00 am

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

Post by deserteagle369 »

I changed 'utf8' to 'utf-8', it work!

Code: Select all

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

ealge
Eagle
Life is a journey.
Post Reply