All Products
Search
Document Center

Object Storage Service:What do I do if garbled characters appear when I preview or download an object whose name contains Chinese characters by using the object URL?

Last Updated:May 09, 2024

This topic describes the solution to the garbled character problem.

For example, garbled characters appear when you download the 测试.txt object to a local computer by using the object URL. In this case, you need to URL-encode the Chinese characters contained in the name. If you want to store the 测试.txt object that you downloaded from Object Storage Service (OSS) in the local computer by using its original name, you must configure the Content-Disposition header in the attachment;filename=%E6%B5%8B%E8%AF%95.txt;filename*=UTF-8''%E6%B5%8B%E8%AF%95.txt format. In this case, URL-encode the original object name in the "attachment;filename="+URLEncoder.encode("测试","UTF-8")+".txt;filename*=UTF-8''"+URLEncoder.encode("测试","UTF-8")+".txt" format.

For more information about how to configure the Content-Disposition header, see Manage object metadata.