Get the App
SLTechnology News&Howtos  ›  Development  › 

The cause of garbled code problem and its solution

Shulou Source: shulou.com Published: 2022-06-03 19:03:35 10月05日 Update

This article mainly explains the causes and solutions of the garbled code problem. The content of the explanation is simple and clear, and it is easy to learn and understand. Please follow the editor's train of thought. Let's study and learn the causes and solutions of the garbled problem.

PHP garbled problem 1. How does PHP deal with uploaded CSV files?

You can use the fgetcsv function:-- read a line from the file pointer and parse the CSV field, but he can't handle the Chinese inside; so after uploading, you have to transcode the csv first.

PHP garbled problem 2. Transcoding

Iconv ("GB2312", "UTF-8"

/ / IGNORE ", file_get_contents ($uploadfile))

Ignore means to ignore conversion errors; but it seems better to mb_convert_encoding with another function

PHP garbled problem 3. Garbled code when Jmail sends a message may also be this reason:

If the page is UTF8 encoded; you can $jmail- > charset = 'utf8'

But most of the inboxes are GB2312, so you can use mb_convert_encoding to transfer the original files.

$zhengwen = 'only moms are good in the world'

$jmail- > Body = mb_convert_

Encoding ($zhennwen, 'GB2312',' UTF-8')

Thank you for your reading. The above is the content of "the cause and solution of garbled code problem". After the study of this article, I believe you have a deeper understanding of the cause and solution of garbled code problem. The specific use of the situation also needs to be verified by practice. Here is, the editor will push for you more related knowledge points of the article, welcome to follow!

Tags: Garbled problems causes methods coding learning content functions files one line only mom fields that is ideas situations meaning pointers articles more Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno MariaDB vpn NVidia Shulou Technology Apple