Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

GD library setting causes an unfixable bug with Cyrillic letters #739

Closed
u1156 opened this issue Oct 30, 2020 · 1 comment
Closed

GD library setting causes an unfixable bug with Cyrillic letters #739

u1156 opened this issue Oct 30, 2020 · 1 comment
Assignees
Labels

Comments

@u1156
Copy link

u1156 commented Oct 30, 2020

ISSUE TYPE

  • Bug Report

OS / ENVIRONMENT

  1. Host operating system and version: MacOS Catalina 10.15.7
  2. (Windows) Native Docker or Docker Toolbox:
  3. Docker version: 19.03.13
  4. Docker Compose version: 1.27.4
  5. (Linux) Is SELinux enabled?:
  6. What git commit hash are you on?: 4b23dd6

SUMMARY

In the Devilbox PHP GD Library is configured with 'JIS-mapped Japanese Font Support: enable'.
It causes an unfixable bug with char detection and Cyrillic letters used in imagettftext() and imagettfbbox().
Adding double conversion with mb_convert_encoding( $text, "SJIS", "UTF-8" ); is not a valuable option because it's not working as one would expect. It can convert about 85% letters but not all. Also double conversion is not optimal.
I heard that GD devs are a long time aware of this bug but it still exists.

Right now if someone uses Devilbox to run a project which relies on imagettftext() + Cyrillic letters it will not work.

It can be fixed by adding an option to disable this GD setting completely. Probably a special PHP image where PHP/GD will be built with configure --disable-gd-jis-conv?

STEPS TO REPRODUCE

  1. Install Devilbox as always.
    Check phpinfo(). Expect to see JIS-mapped Japanese Font Support: enable in GD section.
  2. Create and run a php script:
    Use font PtSans (ttf can be downloaded from Google Fonts) as a font with Cyrillics support
    Use https://www.php.net/manual/ru/function.imagettfbbox.php
    $text_box = imagettfbbox( $fontSize, 0, $font, 'текст на русском языке не работает' );

The same steps are valid for imagettftext();

EXPECTED BEHAVIOUR

Be able to use imagettftext();

ACTUAL BEHAVIOUR

Warning: imagettftext() [function.imagettftext]: any2eucjp(): invalid code in input string

@u1156 u1156 added the bug label Oct 30, 2020
@cytopia cytopia self-assigned this Nov 9, 2020
@cytopia
Copy link
Owner

cytopia commented Nov 9, 2020

Fixed in #743

@cytopia cytopia closed this as completed Nov 9, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants