Join GitHub today
GitHub is home to over 36 million developers working together to host and review code, manage projects, and build software together.Sign up
GBK file being read as UTF-8 when run "kubectl create configmap --from-file" #58503
Is this a BUG REPORT or FEATURE REQUEST?:
What happened: When I'm trying to create a configMap object with a text file encoded by GBK or GB2312 by running the following command,
it seems K8s read and treat it as a UTF-8 text file and all Chinese chars in this file, which I read by mount the configMap into a container in K8s, have been transformed to U+FFFD —— the REPLACEMENT CHARACTER in UTF-8, witch looks like '锟斤拷锟斤拷锟斤拷' in GBK.
before creating the configmap:
some_pc$ file some-gbk-file.txt some-gbk-file.txt: Algol 68 source, ISO-8859 text, with CRLF line terminators
after creating the configmap and mount it into a container:
in-container$ file some-gbk-file.txt some-gbk-file.txt: UTF-8 Unicode text, with CRLF line terminators
What you expected to happen:
How to reproduce it (as minimally and precisely as possible):
export LC_ALL="en_US.UTF-8" echo "测试" > utf8-file.txt iconv -f UTF-8 -t GBK utf8-file.txt -o gbk-file.txt kubectl create configmap test-conf --from-file gbk-file.txt kubectl get configmap test-conf -o yaml > bad-gbk-file.txt cat gbk-file.txt bad-gbk-file.txt # Looks different.