[ZBX-7965] GD and national chars/special chars in graphs Created: 2014 Mar 19  Updated: 2017 May 30

Status: Reopened
Project: ZABBIX BUGS AND ISSUES
Component/s: Frontend (F)
Affects Version/s: 2.3.0
Fix Version/s: None

Type: Incident report Priority: Trivial
Reporter: Janis Eisaks Assignee: Unassigned
Resolution: Unresolved Votes: 0
Labels: gd
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified
Environment:

up-to-date Slackware64-14.0, php 5.3.27, apache 2.4.3, gd 2.0.34


Issue Links:
Duplicate
is duplicated by ZBX-2617 error in showing ° sign in graphs Closed

 Description   

Hi!
If I put national chars in graph name, instead of national chars and special symbols (for example - ?,?,?,?, degree symbol etc) the squares are displayed.

I tried to use one solution found on internet by adding the lines

$string = mb_convert_encoding($string, "HTML-ENTITIES", "UTF-8");
$string = preg_replace('^(&([a-zA-Z0-9])',htmlentities('${1}'),$string);

to the function imageText in graphs.inc.php; but that solved just a half of the problem - national chars are displayed correctly, but not the symbols (it seems there is no entity mapping).

Where could I look in order to find the root of the problem?

Janis

P.S.
GD info:
gd
GD Support enabled
GD Version bundled (2.1.0 compatible)
FreeType Support enabled
FreeType Linkage with freetype
FreeType Version 2.4.11
T1Lib Support enabled
GIF Read Support enabled
GIF Create Support enabled
JPEG Support enabled
libJPEG Version 8
PNG Support enabled
libPNG Version 1.4.12
WBMP Support enabled
XPM Support enabled
libXpm Version 30411
XBM Support enabled
JIS-mapped Japanese Font Support enabled

Directive Local Value Master Value
gd.jpeg_ignore_warning 0 0

php configure options
'./configure' '-with-apxs2=/usr/bin/apxs' 'prefix=/usr' 'libdir=/usr/lib64' 'with-libdir=lib64' 'sysconfdir=/etc' 'disable-safe-mode' 'enable-maintainer-zts' 'disable-magic-quotes' 'enable-zend-multibyte' 'enable-mbregex' 'enable-tokenizer=shared' 'with-config-file-scan-dir=/etc/php' 'with-config-file-path=/etc/httpd' 'enable-mod_charset' 'with-layout=PHP' 'enable-sigchild' 'enable-xml' 'enable-intl=shared' 'with-libxml-dir=/usr' 'enable-simplexml' 'enable-filter' 'disable-debug' 'with-openssl=shared' 'with-pcre-regex=/usr' 'with-zlib=shared,/usr' 'enable-bcmath=shared' 'with-bz2=shared,/usr' 'enable-calendar=shared' 'enable-ctype=shared' 'with-curl=shared' 'with-curlwrappers' 'with-mcrypt=/usr' 'enable-dba=shared' 'with-gdbm=/usr' 'with-db4=/usr' 'enable-exif=shared' 'enable-ftp=shared' 'with-gd=shared' 'with-jpeg-dir=/usr' 'with-png-dir=/usr' 'with-zlib-dir=/usr' 'with-xpm-dir=/usr' 'with-freetype-dir=/usr' 'with-t1lib=/usr' 'enable-gd-native-ttf' 'enable-gd-jis-conv' 'with-gettext=shared,/usr' 'with-gmp=shared,/usr' 'with-iconv=shared' 'with-imap-ssl=/usr' 'with-imap=/usr/local/lib64/c-client' 'with-ldap=shared' 'enable-mbstring=shared' 'enable-hash' 'with-mysql=shared,mysqlnd' 'with-pgsql=shared' 'with-mysqli=shared,mysqlnd' 'with-mysql-sock=/var/run/mysql/mysql.sock' 'enable-pdo=shared' 'with-pdo-mysql=shared,mysqlnd' 'with-pdo-pgsql=shared' 'with-pdo-sqlite=shared,/usr' 'with-enchant=shared,/usr' 'enable-shmop=shared' 'with-snmp=shared,/usr' 'enable-soap=shared' 'enable-sockets' 'with-sqlite=shared' 'with-sqlite3=shared' 'enable-sqlite-utf8' 'with-regex=php' 'enable-sysvmsg' 'enable-sysvsem' 'enable-sysvshm' 'enable-wddx=shared' 'with-xsl=shared,/usr' 'enable-zip=shared' 'with-tsrm-pthreads' 'enable-shared=yes' 'enable-static=no' 'with-gnu-ld' 'with-pic' '-build=x86_64-slackware-linux'



 Comments   
Comment by Oleksii Zagorskyi [ 2014 Mar 20 ]

We are sorry, but this is zabbix issue tracker.

Ask help on community https://www.zabbix.org/wiki/Docs/bug_reporting_guidelines

Comment by Oleksii Zagorskyi [ 2014 Mar 20 ]

Well, point is - why do you compile PHP from sources (not very common case) and complains that something wrong with zabbix code?

I'm sure (just have checked it) that the symbols are rendered correctly.
So you have some unclear issues with own compiled PHP or on db side (encoding etc).

You may use zabbix appliance to check the symbols and step by step find what is wrong on your side.
https://www.zabbix.com/documentation/2.2/manual/appliance

Comment by Oleksii Zagorskyi [ 2014 Mar 20 ]

Reopened according to Rich's suggestion.

Comment by Janis Eisaks [ 2014 Mar 20 ]

The reason behind php compilation is simple - it does not include PostgreSQL support. At least - on the distro I am used to for more that 10 years.

There is no question about abandoning postgres, because is is the sole DB my spell checking development site relies on (not developed by me but, aacording to author, heavily relying on unique postgres language-related functions).

I have to admin that the described effect is also seen on fresh Slackware installations (for example - it was also the case for the virtual server farm I had opportunity to demonstrate to Zabbix team two weeks ago).

Janis

Comment by Janis Eisaks [ 2014 Mar 20 ]

P.S.
I can't imagine how more utf8-bin-ish DB could be.
If I browse items' DB in phpMySQL Admin, I see the degree symbol as it should be. So it seems the problem lies with php/GD.

Just few minutes ago I upgraded libgd to 2.1.0 and re-built the php (5.3.27) - no changes.

With the php hack mentioned before I can at least get Latvian letters on graphs, but it does not explain "selectivity" of solution.

Janis

Comment by Janis Eisaks [ 2014 Mar 21 ]

Solution (for now) for the case one has to use php 5.3 and had to rebuild his php v.5.3.x
Exploring the problem closer, I found that imagettftext is arguing like this:

PHP Warning: imagettftext(): any2eucjp(): invalid code in input string

So, in order to get mentioned chars displayed correctly, one has to remove

--enable-gd-jis-conv

from php configure parameters.
It seems the problem is characteristic to php 5.3 only, because even re-built php-5.4 on the same system lacks such problems. Unfortunately, support for Japanese is lost in this case.

Janis

Comment by richlv [ 2014 Mar 21 ]

hmm. might be worth adding some tests in the config wizard, but we should figure out how japanese users are configuring php

Comment by Oleksii Zagorskyi [ 2014 Mar 22 ]

I recall exactly the same issue on zabbix forum (on russian), tried to find it but without success.
As I recall - after disabling sort of "Japanese font support" the PHP started to render fonts correctly.

Comment by Kodai Terashima [ 2014 Mar 24 ]

We don't do anything for Japanese, just replace font file.

I found an information --enable-gd-jis-conv option try to convert utf8 to shift-jis, but imagettftext use utf8. Characters that are shown as images garbled if the compile option is enabled.

Comment by richlv [ 2014 Apr 08 ]

so we should probably prohibit gd jis conversion in the config wizard

Generated at Fri Apr 25 07:51:06 EEST 2025 using Jira 9.12.4#9120004-sha1:625303b708afdb767e17cb2838290c41888e9ff0.