search
HomeBackend DevelopmentPHP ProblemWhat to do if php watermark is garbled

Solution to garbled watermark in php: 1. Remove the "--enable-gd-jis-conv" option and recompile php; 2. Convert characters to html entities using the method "mb_convert_encoding ()".

What to do if php watermark is garbled

php Use Gd library to add garbled text watermark problems and solutions

A recent project After migrating the server, it was discovered after deployment that one of the functions of adding watermark text to pictures had a garbled problem. It was confirmed that there was no problem with the function code. At the same time, the project codes were all encoded in UTF-8, and there was no encoding problem. The fonts were also checked and excluded. There is a possibility of a problem with the file. After consulting the information, I finally found a PHP compilation parameter --enable-gd-jis-conv.

--enable-gd-jis-conv:

If the --enable-gd-jis-conv option is enabled when compiling PHP, non-ASCII characters (such as Chinese characters, pinyin, Greek and arrows) will be regarded as EUC-JP encoding, eventually leading to normal Chinese changes. Into garbled characters

Solution:

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

2. Convert characters to html entities

mb_convert_encoding ('测试', 'HTML-ENTITIES', 'UTF-8');

Recommended: "PHP Tutorial"

The above is the detailed content of What to do if php watermark is garbled. For more information, please follow other related articles on the PHP Chinese website!

Statement
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

Video Face Swap

Video Face Swap

Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Tools

Atom editor mac version download

Atom editor mac version download

The most popular open source editor

SublimeText3 Linux new version

SublimeText3 Linux new version

SublimeText3 Linux latest version

mPDF

mPDF

mPDF is a PHP library that can generate PDF files from UTF-8 encoded HTML. The original author, Ian Back, wrote mPDF to output PDF files "on the fly" from his website and handle different languages. It is slower than original scripts like HTML2FPDF and produces larger files when using Unicode fonts, but supports CSS styles etc. and has a lot of enhancements. Supports almost all languages, including RTL (Arabic and Hebrew) and CJK (Chinese, Japanese and Korean). Supports nested block-level elements (such as P, DIV),

MinGW - Minimalist GNU for Windows

MinGW - Minimalist GNU for Windows

This project is in the process of being migrated to osdn.net/projects/mingw, you can continue to follow us there. MinGW: A native Windows port of the GNU Compiler Collection (GCC), freely distributable import libraries and header files for building native Windows applications; includes extensions to the MSVC runtime to support C99 functionality. All MinGW software can run on 64-bit Windows platforms.

SublimeText3 English version

SublimeText3 English version

Recommended: Win version, supports code prompts!