Php uses the Gd library to add Garbled text watermarks and solutions,

Source: Internet
Author: User

Php uses the Gd library to add Garbled text watermarks and solutions,

Recently a project for server migration, deployment found that one of the image to add watermark text function garbled problem, confirm that the function code is not a problem, while the project code is using UTF-8 encoding, there is no encoding problem, and the check also ruled out the possibility of a problem with the font file. After finally checking the information, the php compilation parameter -- enable-gd-jis-conv is locked.

-- Enable-gd-jis-conv:

If the-enable-gd-jis-conv option is enabled during PHP compilation, non-ASCII characters (such as Chinese characters, Pinyin, Greek and arrows) are treated as EUC-JP encoding, eventually, normal Chinese characters become garbled characters.

Solution:

1. Remove the -- enable-gd-jis-conv option and re-compile php

2. Convert characters to html Objects

Mb_convert_encoding ('test', 'html-ENTITIES ', 'utf-8 ');

 

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.