Home>Article>Backend Development> What to do if php outputs garbled xml code

What to do if php outputs garbled xml code

藏色散人
藏色散人 Original
2020-07-13 09:23:48 3245browse

php xml garbled code is caused by the inconsistency between the PHP program output encoding and the encoding of the XML file. The solutions are: 1. Change gb2312 to "utf-8"; 2. Directly set the PHP file format to ansi The output is normal.

What to do if php outputs garbled xml code

The reason for the error is that the PHP program output encoding and the encoding of the XML file are inconsistent.

Method 1:

Use utf-8 encoding, the modification method is as follows:

1. Change the two gb2312 to utf-8

2. Click the right link on the xml file and select use Open Notepad, save as, change the encoding from ansi, overwrite and save.

Method 2:

Directly set the PHP file format to ansi, and the output will be normal

For more related knowledge, please visitPHP Chinese website!

The above is the detailed content of What to do if php outputs garbled xml code. 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