In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-18 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)06/01 Report--
This article is about how to solve the problem of Chinese garbled code in Docker container. I think it is very practical, so I share it with you. I hope you can get something after reading this article. Let's take a look at it.
After the front desk uploads the file to the server, Chinese garbled appears in the list of files returned by the server to the front desk, and all Chinese file names become? The English file name is displayed normally
After locating the problem, it is found that this exception occurs when the multipartfile class of the background code executes the method of transterto, but the multipartResolver and encodingFilter in the configuration file set have been set to UTF-8 to exclude the code exception. When kubectl exec enters the docker container for viewing, it is found that the file is also abnormal in Chinese file name display in the container. Check the docker container encoding format: execute the locale command; you can see that the current encoding format is POSIX, but this encoding format does not support Chinese
Solution: locale-a view all locales of the container
C.UTF-8 can support Chinese, as long as the container code is set to C.UTF-8.
1. Temporary modification:
Locale
Locale-a
LANG=C.UTF-8 (there are plenty of zh_CN.UTF-8, but I didn't find this code locally)
Source / etc/profile
two。 Permanent modification: modifying Dockerfile
Add a row to the Dockerfile
ENV LANG C.UTF-8
Re-create the docker image. After docker run-ti [Image] enters the container, locale finds that the encoding format has been modified to C.UTF-8, and the previous problem of garbled Chinese file names has been eliminated.
The above is how to solve the problem of Chinese garbled in the Docker container. The editor believes that there are some knowledge points that we may see or use in our daily work. I hope you can learn more from this article. For more details, please follow the industry information channel.
Original link: http://www.cnblogs.com/z-belief/archive/2016/12/09/6148463.html
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.