Home > Backend Development > PHP Problem > How to solve the problem of garbled display of traditional Chinese characters in php

How to solve the problem of garbled display of traditional Chinese characters in php

藏色散人
Release: 2023-03-13 13:22:02
Original
3320 people have browsed it

Solution to php Traditional Chinese characters displaying garbled characters: 1. Open the corresponding PHP file; 2. Convert the character encoding through the "mb_convert_encoding" function.

How to solve the problem of garbled display of traditional Chinese characters in php

The operating environment of this article: Windows7 system, PHP7.1 version, DELL G3 computer

How to solve php Traditional Chinese Display garbled code problem?

php function to solve the problem that simplified and traditional Chinese characters display garbled characters in the web interface

The solution for simplified and traditional Chinese characters to display garbled characters in the web interface:

mb_convert_encoding($str,'gbk','utf-8');
Copy after login

gbk is Traditional Chinese encoding, gb2312 is simplified Chinese encoding. But gbk contains gb2312, so if the array contains traditional Chinese and simplified characters, just use gbk to convert.

Note: mb_convert_encoding - Convert character encoding

Description

string mb_convert_encoding ( string $str , string $to_encoding [, mixed $from_encoding = mb_internal_encoding() ] )
Copy after login

Convert the character encoding of string type str from optional from_encoding to to_encoding.

Recommended learning: "PHP Video Tutorial"

The above is the detailed content of How to solve the problem of garbled display of traditional Chinese characters in php. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
php
source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template