astefanutti / kubebox

⎈❏ Terminal and Web console for Kubernetes
http://astefanutti.github.io/kubebox
MIT License
2.16k stars 140 forks source link

Can log terminal support display Chinese words ? #39

Closed 593769290 closed 5 years ago

593769290 commented 5 years ago

kubebox obviously is a great k8s tool for our small team.

But when I setup an environment to running kubebox, I found in the logs terminal Chinese words all changed to ?????????.
The shell windows is OK.

would you please when you are free, task a demo test and debug where is the problem.

the demo test files list:

  1. Dockerfile
    
    FROM docker.io/alpine:3.7

COPY test.log / COPY run.sh / ENV LANG="C.UTF-8" ENTRYPOINT ["/run.sh"]


2. run.sh

!/bin/sh

tail -f -n90 /test.log


3. test.log

在Docker容器bash中输入中文

在Docker容器bash中输入中文

docker alpine版本服务中显示中文

docker alpine版本服务中显示中文

docker alpine版本服务中显示中文

解决docker容器不支持中文的问题


In browser, log terminal showing:

??Docker????bash?????????? │ │ │ │??Docker????bash?????????? │ │ │ │docker alpine?????????????????? │ │ │ │docker alpine?????????????????? │ │ │ │docker alpine?????????????????? │ │ │ │????docker???????????????????? │


In API direct request show normal result - `https://kubebox.xxxx.com/master/api/v1/namespaces/namespace-dev/pods/alpine-cn-5c8584bd96-6klvl/log?follow=true&tailLines=10000&timestamps=true&container=alpine-cn&sinceTime=2019-04-18T08%3A21%3A19.334100106Z`:

2019-04-18T08:21:19.333943583Z 在Docker容器bash中输入中文 2019-04-18T08:21:19.333950662Z 2019-04-18T08:21:19.333954261Z 在Docker容器bash中输入中文 2019-04-18T08:21:19.333958322Z 2019-04-18T08:21:19.333961629Z docker alpine版本服务中显示中文 2019-04-18T08:21:19.333965169Z 2019-04-18T08:21:19.333968374Z docker alpine版本服务中显示中文 2019-04-18T08:21:19.333971711Z 2019-04-18T08:21:19.333974847Z docker alpine版本服务中显示中文 2019-04-18T08:21:19.333978286Z 2019-04-18T08:21:19.333981377Z 解决docker容器不支持中文的问题

astefanutti commented 5 years ago

Thanks for the report. I'll test it ASAP.

593769290 commented 5 years ago

how to optimize the code in lib/http-then.js line 105:

const res = gen.next(new Buffer(event.data, 'binary'));

need something like?

String.fromCharCode.apply(null, new Uint8Array(event.data))
593769290 commented 5 years ago

Thanks for the report. I'll test it ASAP.

can you have time to make a test? it maybe the getWebSocketStream arraybuffer has not be converted properly using utf8 encoding. but i am a newer to nodejs, and I can't understand the code below executing process. const res = gen.next(......) so,i have tried to make it work,but i failed.

astefanutti commented 5 years ago

I'll try to test it in the upcoming days.

astefanutti commented 5 years ago

This should be fixed with a4141e193c2e62fc0385f477b95d78c2e32047d4.

Thanks again for the report.

593769290 commented 5 years ago

Beautiful! Thanks so much!