Replies: 1 comment 4 replies
-
Hi @Lelik2107 included files from configuration are opened there in the code: glpi-agent/lib/GLPI/Agent/Config.pm Line 240 in ea45347 Actually, we don't try to analyze included file encoding as this is dedicated to configuration and we don't expect exotic encoding in cfg files. About "tag", this is a configuration string which make sens in GLPI to be used in the rules engine. It permits for example to assign an entity or a location. My guess is you should keep the problem as simple as possible and so you should not use exotic encoding here. I of course understand simplicity could be let me use my natural language. But "tag" has not been developed in that usage in mind. As I understand, you developed a user interface which generates your "inf" files. You should probably manage to update that interface to set "tag" in a supported way by glpi-agent without using specific encoding: just use some coding conventions that you can analyze in GLPI. Tell me if I'm wrong, but your real concern is to use these tags for rules, so simplifying them before inclusion should be your first goal, so rules in GLPI won't have to be too complicated. |
Beta Was this translation helpful? Give feedback.
-
Your question
Hello everyone! The problem indicated in title. In details:
Using utf8 I need attach file with "tag" value. "Tag" vary and defines by script, when user input some info interactively.
It saved in (tag.inf), attaches to inventory report by "include" directive in agent.cfg file.
When Agent is attaching file the collision. Appears a problem for non-latin chars (strings) - two-three-four byte unicode.
As I learned - durin attachment of tag*.inf, my files with "tag = " line consist with latin and non-latin chars (tag = Л-10GJ - first letter is cyrillic letter "El" (13th in cyrill.alphabet). But Agent reads such chars as Byte-Array, but not Char-Array. Because of it the result is two-bytes sequence instead of cyrillic two-byte chars.
I've attach a little of files (ZIP) with vary codings. Files tag*.inf are files attached by Agent. Report*.* - XML results, logs of Agent. And agent.cfg also.
Codepage for Agent is 65001. Files tag*.inf in codepages - cp866, cp1251, cp65001 (look by names). XML results in UTF8. Environment : OS Windows 10 Pro Russian Edu; GLPI-Agent 1.7.1 x86 (because runs on old systems too); GLPI Server 10.0.7 (Ubuntu 18).
The results of import of these encodings are always different. Result string from one report (cp 65001) is:
[Thu Feb 8 12:40:35 2024][info] New inventory from j229pc02-2024-02-08-12-40-35 for local0 (tag=IVC_MPI_�-10�::)
(Secon letter is "De" - 4th letter)_
**But just in cp65001 i see a right (D0x9B (utf8 letter El) and D0x94 (utf8 letter De) ) two-byte! sequenses - but not utf-8 cyrillic chars!**
It's so strange, but I no see something, may be?
Lets discuss it, it's so serious! There is a solution already?
But I didn't found proper here...
For information on "tag": it contains department code (latin) and room number (cyrillic). Parsed with regexp.
Thanks.
agent-include.zip
Beta Was this translation helpful? Give feedback.
All reactions