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!