首页 Function Compute Function Compute FAQ Code development General FAQ What do I do if a code package contains garbled characters after it is uploaded to Function Compute?

What do I do if a code package contains garbled characters after it is uploaded to Function Compute?

更新时间: 2026-04-01 10:30:49

Garbled characters after uploading a code package to Function Compute fall into two categories: garbled file names and garbled file content. Identify which category matches your situation, then follow the corresponding fix.

Garbled characters in a file name

File names appear garbled after uploading a ZIP created on Windows

Cause: The ZIP format historically defaulted to CP437 (IBM PC encoding) for file name metadata. Windows compression tools typically write file names using the local system code page (such as GBK or CP936) rather than UTF-8. Because Function Compute reads file names in UTF-8 by default, this encoding mismatch produces garbled characters during extraction.

Fix: Use a compression tool that writes file name metadata in UTF-8. Most modern tools support this as a configurable option. When decompressing an archive created on Windows, set the decoding to match the code page used when the archive was created.

File names appear garbled even without ZIP compression

Cause: Function Compute reads file names in UTF-8 by default. If a file name is encoded in a non-UTF-8 character set (such as GBK, Shift-JIS, or Latin-1), the characters cannot be decoded correctly and appear garbled.

Fix: Rename the files using UTF-8 encoding before uploading.

Garbled characters in file content

Source code file content appears garbled in the console

Cause: Function Compute reads file content in UTF-8 by default. Source code files—such as Python scripts—saved in a non-UTF-8 encoding (for example, GBK or Latin-1) cannot be decoded correctly, resulting in garbled characters.

Fix: Open the file in a text editor that shows the current encoding, then re-save it as UTF-8.

File content appears garbled and the file may be damaged

Cause: A corrupted or malformed file may fail to decode regardless of encoding settings.

Fix: Check the file for integrity. If the file is corrupted, re-download it or obtain a clean copy from a reliable source.

File content contains unexpected symbols or boxes

Cause: The file contains special characters or non-printable characters (such as control characters) that are not handled correctly by the viewer.

Fix: Open the file in a text editor that supports multiple encodings and can display or convert non-printable characters. Identify and remove or replace the problematic characters before re-uploading.

上一篇: How do I install FFmpeg of a specified version? 下一篇: FAQ about PHP runtimes
阿里云首页 函数计算 相关技术圈