You are not logged in.

Announcement

 Téléchargez la dernière version stable de GLPI      -     Et vous, que pouvez vous faire pour le projet GLPI ? :  Contribuer
 Download last stable version of GLPI                      -     What can you do for GLPI ? :  Contribute

#1 2009-06-22 06:53:48

masonmark
Guest
Registered: 2009-03-18
Posts: 12

OCS NG fixed to use UTF-8 for text! But, text still corrupted in GLPI

The OCS NG project has some people (at least, one cool guy named linvinus), who are finally fixing the problem where OCS does not work with text from multiple languages (like Russian, Japanese...)

http://forums.ocsinventory-ng.org/viewtopic.php?id=4104

If you read that thread, you can find linvinus-created binaries of OCS NG Unix Server and also Windows agent. I installed those for test: works great! Previously OCS NG was not usable with Japanese Windows XP clients, because all Japanese text was turned to garbage. Now it works!

That is great, but I want to use it with GLPI. However, text imported from OCS NG by GLPI still shows up as "????" garbage. For example, the PC imported from OCS NG into GLPI has a hard disk named "????" and a network card named "AMD ???? ????" and so on.

But in the OCS NG web interface, the proper Japanese is displayed. And it is in the database also, if you look at the raw MySQL tables.

Why is this?

I confirmed:

a.) OCS NG database is UTF-8
b.) OCS web UI presents UTF-8 pages (<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=utf8;">)

...and I know GLPI has properly used UTF-8 for a long time. So, why does the imported data not get into GLPI successfully?

These fixes are not yet released by OCS project, but linvinus's code is already in their svn trunk, so will be included in future OCS release.

Is something wrong with GLPI's import-from-OCS feature where it cannot get UTF-8 text? Can anybody suggest where to start looking to fix this?

If I cannot figure out how to fix this, my other idea is to use OCS dictionaries to make every Japanese item into an English name. However, this is tedious and all my staff is Japanese so it is not ideal.

Thanks for any help or info!

Offline

#2 2009-06-22 07:36:32

remi
GLPI-DEV
From: Champagne
Registered: 2007-04-28
Posts: 7,127
Website

Re: OCS NG fixed to use UTF-8 for text! But, text still corrupted in GLPI

> So, why does the imported data not get into GLPI successfully?
Because GLPI works with Official OCS.

linvinus also give a minor fix for GLPI (you should search the full thread about it)

But I think we cannot really help with this (not a official OCS release)

+


Dév. Fedora 29 - PHP 5.6/7.0/7.1/7.2/7.3/7.4 - MariaDB 10.3 - GLPI master
Certifié ITILv3 - RPM pour Fedora, RHEL et CentOS sur https://blog.remirepo.net/

Offline

#3 2009-06-22 07:38:41

masonmark
Guest
Registered: 2009-03-18
Posts: 12

Re: OCS NG fixed to use UTF-8 for text! But, text still corrupted in GLPI

More information: Looking in glpi/inc/ocsng.class.php I found that GLPI creates database connection using "latin1" encoding when importing from OCS.

Maybe this is good for current (broken) OCS release version, because OCS always uses this encoding. However, OCS will fix this long-standing bug soon, and at that point this behavior will become a bug in GLPI.

For now, in my installation, I could fix the problem by changing the single line in the constructor function for DBocs class (line 57 in my ocsng.class.php source code file):

                $this->dbenc="latin1";

to this:

                $this->dbenc="utf8";

Et voila! I have my OCS agent running on PCs using Windows XP Japanese collecting the data, it works in OCS web UI, and it now gets correctly imported into GLPI.

However, there are a couple other places in GLPI source code where "latin 1" is hard-coded. Maybe ok, or maybe not ok, I am not sure. Seems to be only for "SET NAMES 'latin1'" MySQL command, so it might be fine. Anyway, if you full-text search the code base for 'latin1' you can find them all.

I think it would be nice to coordinate with OCS project to make this work out smoothly. The needed changes on GLPI side seem to be minor.

I am still just testing, so I hope my fix works here in Japan, so we can start using OCS in production (we already use GLPI).

Cheers,
--
Mason

GLPI 0.7.5 on Ubuntu 8.04
OCSNG_UNIX_SERVER-1.02.1-linvinus-with-utf8_patch
windows-agent_1.02-patched compiled by livinus May 7, 2009 version

Offline

#4 2009-06-22 19:32:56

remi
GLPI-DEV
From: Champagne
Registered: 2007-04-28
Posts: 7,127
Website

Re: OCS NG fixed to use UTF-8 for text! But, text still corrupted in GLPI

> I think it would be nice to coordinate with OCS project to make this work out smoothly.
Of course GLPI and OCS works together.

But linvinus patch IS NOT OCS.

+


Dév. Fedora 29 - PHP 5.6/7.0/7.1/7.2/7.3/7.4 - MariaDB 10.3 - GLPI master
Certifié ITILv3 - RPM pour Fedora, RHEL et CentOS sur https://blog.remirepo.net/

Offline

#5 2009-06-23 23:39:41

EmpereurZorg
Guest
From: ORLEANS
Registered: 2005-12-31
Posts: 599

Re: OCS NG fixed to use UTF-8 for text! But, text still corrupted in GLPI

remi wrote:

> I think it would be nice to coordinate with OCS project to make this work out smoothly.
But linvinus patch IS NOT OCS.
+

It seems that the code of linvins will be included in OCS : http://forums.ocsinventory-ng.org/viewt … 751#p18751
However, very interesting thread ! (we have some Japanese OS wink )


Version GLPI : 0.85.2 + Plug'in FusionInventory 0.85+1.1 + Agents 2.3.15
Plateforme : Debian 7, Apache 2.2.22, PHP 5.4.39
Navigateur : Firefox 38 / Chrome occasionel

Offline

#6 2009-06-24 08:42:59

wawa
GLPI-DEV
From: Montpellier / France
Registered: 2006-07-03
Posts: 6,019
Website

Re: OCS NG fixed to use UTF-8 for text! But, text still corrupted in GLPI

EmpereurZorg wrote:

It seems that the code of linvins will be included in OCS : http://forums.ocsinventory-ng.org/viewt … 751#p18751

if it's included in an official OCS release, then we'll do the necessary modifications to be compatible

Offline

Board footer

Powered by FluxBB