Docker Container Chinese garbled (Modify Docker container encoding format) solution _docker

Source: Internet
Author: User
Tags locale docker run

After the front upload files to the server, the server returned to the foreground of the file list in Chinese garbled, all the Chinese file name into? , the English file name is displayed normally.

The problem is positioned to find that the Multipartfile class of the background code has this exception when executing the Transterto method, but Multipartresolver and encodingfilter in the configuration file set are already UTF-8. Excludes code exceptions. KUBECTL exec enters into the Docker container to see that the file in the container is also the Chinese file name display exception. View the Docker container encoding format: Execute the locale command; You can see that the current encoding format is POSIX, and this encoding format does not support Chinese

Workaround: Locale-a View all locales of the container

C.utf-8 can support Chinese, just set the container code to C.utf-8

1. Temporary Modifications:

Locale
Locale-a
Lang=c.utf-8 (some zh_cn. UTF-8, but I didn't find this code locally.
Source/etc/profile

2. Permanent modification: Modify Dockerfile

Add a row to the Dockerfile

ENV LANG C.utf-8

Re-made Docker mirror, Docker Run-ti [mirror] into the container after the implementation of locale found that the encoding format has been modified to c.utf-8, the previous occurrence of the Chinese file name garbled problem is not.

The above is a small set to introduce the Docker container Chinese garbled (Modify Docker container coding format) solution, I hope to help you, if you have any questions please give me a message, small series will promptly reply to everyone. Here also thank you very much for the cloud Habitat Community website support!

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.