1 (edited by bhchen 2008-03-14 12:37:13)

Topic: Change of CHARSET possible?

Hi, all:

This is THE BEST labware I've seen so far - highly flexible/configurable!!
I'm just wondering if there's any way for users being able to input character other than English (urf-8), as I would like to use some text in traditional Chinese (BIG5); but, all my entered text was shown as unreadable garbage.
Many thanks for helping novice out in advance!!  :-)

2

Re: Change of CHARSET possible?

Sorry, what I really meant was if there's any way to declare the usage of BIG5 characters somewhere inside the config.php script?  I just realized that my IE and Firefox were both able to correctly display big5 characters, but for some reason, the default coding has always been urf-8, so that I had to manually change it to big5.  Hope this clearifies my previous question clear.  Thanks again!!

3

Re: Change of CHARSET possible?

Big5 characters should be displayed properly in a page declared as UTF-8. UTF-8 is the character-set encoding recommended for web-pages. Among other things, UTF-8 allows one to mix different characters-sets on the same page: 用統一码, 打廣東話又得, 写普通话也行, 日本語もできる、tiếng Việt cũng được

PHP/HTML char-set
LabStoRe sends the utf-8 declaration through these codes in files ./header.php, interface_creator/header.php and interface_creator/header_admin.php:

header('Content-Type: text/html; charset=utf-8');
...
<meta http-equiv="content-type" content="text/html; charset=utf-8" />

MySQL char-set
UTF-8 is also the character-set encoding for the MySQL database tables. The .sql file that comes with LabStoRe has lines like these for this purpose:

SET NAMES utf8;
...
ENGINE=MyISAM DEFAULT CHARSET=utf8;

For MySQL database queries, LabStoRe (file interface_creator/functions.php) uses the code: mysql_query("SET NAMES 'utf8'", $conn);.

If the MySQL database system is older than version 4.1 (poorer support for various character sets), or if the database tables are not in UTF-8, then there could be problems like the one you mention. If MySQL is older than version 4.1, see if you can upgrade it. Check if the tables are in UTF-8 using phpMyAdmin, command line code, etc. If they are not, change the encoding to UTF-8. If they hold a lot of data in non-UTF-8 encoding, check the MySQL manual/web-pages before proceeding to ensure that data loss/corruption doesn't occur.

Bug
Also, there appears to be some code missing in the file ./header.php -- perhaps that's the cause in your case. I will fix it in the next LabStoRe release, but for now you can add this line before the '// Get client's IP address' line:

mysql_query("SET NAMES 'utf8'", $connection);

4

Re: Change of CHARSET possible?

patnaik wrote:

PHP/HTML char-set
LabStoRe sends the utf-8 declaration through these codes in files ./header.php, interface_creator/header.php and interface_creator/header_admin.php:

header('Content-Type: text/html; charset=utf-8');
...
<meta http-equiv="content-type" content="text/html; charset=utf-8" />

MySQL char-set
UTF-8 is also the character-set encoding for the MySQL database tables. The .sql file that comes with LabStoRe has lines like these for this purpose:

SET NAMES utf8;
...
ENGINE=MyISAM DEFAULT CHARSET=utf8;

For MySQL database queries, LabStoRe (file interface_creator/functions.php) uses the code: mysql_query("SET NAMES 'utf8'", $conn);.

If the MySQL database system is older than version 4.1 (poorer support for various character sets), or if the database tables are not in UTF-8, then there could be problems like the one you mention. If MySQL is older than version 4.1, see if you can upgrade it. Check if the tables are in UTF-8 using phpMyAdmin, command line code, etc. If they are not, change the encoding to UTF-8. If they hold a lot of data in non-UTF-8 encoding, check the MySQL manual/web-pages before proceeding to ensure that data loss/corruption doesn't occur.

Bug
Also, there appears to be some code missing in the file ./header.php -- perhaps that's the cause in your case. I will fix it in the next LabStoRe release, but for now you can add this line before the '// Get client's IP address' line:

mysql_query("SET NAMES 'utf8'", $connection);

Many many thanks to your prompt and detailed guidance on my question.
After replacing the 'utf-8' with 'big5' in those .php files you mentioned, that indeed took care of my webpage display problem.
Our server uses MySQL v4.0.18 and I had encounterd SQL import error (stating that there was some syntax error in the line of "ENGINE=MyISAM DEFAULT CHARSET=utf8;") when I initially installed labstore and tried to import the included .sql files from the package into my database.  But, after removing 'DEFAULT CHARSET=utf8' (it even returned similar error message if I changed 'utf8' to 'big5'), the .sql files seemed to import just fine.

I really appreciated your putting this excellent labware out for general public.  I'm been bothered by how to keep my lab's inventory on track and finally labstore answered my call!!  Great job!!  :-)

5

Re: Change of CHARSET possible?

Thank you for trying LabStoRe. I had developed it keeping my lab's expectations in mind. Hopefully I will release a new version soon with changes that will incorporate some of the suggestions I've received from other labs. If you've any, do let me know. LabStoRe definitely can be improved a lot.

One suggestion I've for your setup is to see if the MySQL can be upgraded. If so, then I suggest not replacing utf-8 with Big5.

6

Re: Change of CHARSET possible?

Sometimes it's a bit difficult to ask school's IT personnel to upgrade system's software to meet your expectations or needs, but I am planning to completely implement labstore onto my own lab's server once the testing is done.  I am also curious about security concern regarding php script of this kind (since some folders' permission needs to be set at either write or execute), in that our school admin often inform me of my teaching website (running with xoops platform) has been frequently implanted trojan or other malicious scripts by crawler and he often advised me of not running website with .php scripts.  Will this be a concern with Labstore?  I've implemented the .htaccess/.htpassword security as stated in the help file, but am not sure if that's enough to impede hackers from intruding into folders under this labware at all?  Thanks.

My two suggestions for your next version would be (am not sure if they are already in this version):
1. Has configurable capability (under Admin, of course) to create new modules, as different labs always have different needs for inventory purposes.  Although I've read some threads in this forum as how to create new module, but it's certainly beyond the capability of many novice users like myself.
2. Has capability (Admin) to offline update the .csv or .xls file for each table, then simply ftp or import into the database to update the inventory.

Looking forward to your next release soon!!  :-)

Regards,

7

Re: Change of CHARSET possible?

Relevant issues fixed in release 1.5.3 (Feb 2009)

8

Re: Change of CHARSET possible?

Many thanks for your notice..