-
Notifications
You must be signed in to change notification settings - Fork 3.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
UnicodeDecodeError with method read_namespaced_pod_log() #2118
Comments
/assign @yliaog |
seems to be similar issue |
agreed it's better to support more charset, but python/kubernetes/client/rest.py is generated by openapi generator, so the support needs to be added there. |
I had the same problem and applying the above solution worked. So I modified the code a little bit and added a function to allow setting the character set for the client. I attached the diff here. |
The Kubernetes project currently lacks enough contributors to adequately respond to all issues. This bot triages un-triaged issues according to the following rules:
You can:
Please send feedback to sig-contributor-experience at kubernetes/community. /lifecycle stale |
The Kubernetes project currently lacks enough active contributors to adequately respond to all issues. This bot triages un-triaged issues according to the following rules:
You can:
Please send feedback to sig-contributor-experience at kubernetes/community. /lifecycle rotten |
The Kubernetes project currently lacks enough active contributors to adequately respond to all issues and PRs. This bot triages issues according to the following rules:
You can:
Please send feedback to sig-contributor-experience at kubernetes/community. /close not-planned |
@k8s-triage-robot: Closing this issue, marking it as "Not Planned". In response to this:
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. |
What happened (please include outputs or screenshots):
While using the following
pod_logs = v1.read_namespaced_pod_log(name=pod_name, namespace=namespace)
. I receive the error:What you expected to happen:
The pod logs are displayed correctly.
How to reproduce it (as minimally and precisely as possible):
Use pods where the output is not utf-8. In my case it's latin-1.
Anything else we need to know?:
There are legacy applications where the output has to be in a special charset. Therefore, it would be great when the method
read_namespaced_pod_log
from thekubernetes.client.CoreV1Api()
could have a parameter charset, where the developer can choose a desired charset. For example:pod_logs = v1.read_namespaced_pod_log(name=pod_name, namespace=namespace, charset='latin1')
As stated above at the moment the charset utf-8 is hardcoded in:
python/kubernetes/client/rest.py
Line 232 in 68d5a14
It worked as soon as I changed
r.data = r.data.decode('utf8')
tor.data = r.data.decode('latin1')
Environment:
The text was updated successfully, but these errors were encountered: