VNC Viewer从本地windows复制粘贴中文到ubuntu服务器中出现乱码(准确来说是unicode)的情况
VNC Viewer从本地windows复制粘贴中文到ubuntu服务器中出现乱码(准确来说是unicode)的情况
文章目录
- 前言
- 环境
- 问题描述
- workaround (临时方案)
- 小结
前言
创作开始时间:2021年8月3日11:48:26
如题。这是一个bug,目前没找到解决方案,只有临时方案workaround。故在此探究记录一下。
环境
- ubuntu 16.04 阿里云服务器
- windows 10 本地主机
- VNC Viewer
- vnc 配置如下:
apr@apr:~/wrapped_url$ cat ~/.vnc/xstartup
#!/bin/sh
# Uncomment the following two lines for normal desktop:
# unset SESSION_MANAGER
# exec /etc/X11/xinit/xinitrc
[ -x /etc/vnc/xstartup ] && exec /etc/vnc/xstartup
[ -r $HOME/.Xresources ] && xrdb $HOME/.Xresources
xsetroot -solid grey
#vncconfig -iconic &
vncconfig &
#x-terminal-emulator -geometry 80x24+10+10 -ls -title "$VNCDESKTOP Desktop" &
#x-window-manager &
gnome-panel &
gnome-settings-daemon &
metacity &
nautilus &
gnome-terminal &
问题描述
从本地windows复制一段中文,通过VNC viewer连接ubuntu,在图形界面中拷贝到ubuntu的gedit或者vscode编辑器的文件中,发现是乱码!(太难受了)
但是我从xshell拷贝中文是可以正常拷贝的(没有乱码)。
但是!从vncviewer图形界面中拷贝中文到网页CSDN博客编辑器,发现是乱码!拷贝到sublime编辑器,发现是unicode。类似这种:\u53c2\u8003\u6587\u732e
如下:(https://www.bejson.com/convert/unicode_chinese/)
真的太坑了。害得我以为是locale的问题。还做了尝试:
- 【已解决】Ubuntu中文显示为乱码 (或者:如何让ubuntu显示为中文界面) https://dalewushuang.blog.csdn.net/article/details/119343204
太坑了。
后面参考:
- Clipboard does not transfer unicode strings between client and server #20 https://github.com/TigerVNC/tigervnc/issues/20
- Bug 1825314 - VNC clipboard copy-and-pastes Unicode characters incorrectly https://bugzilla.redhat.com/show_bug.cgi?id=1825314
感觉是vnc的bug。(虽然网页参考讨论的是tigerVNC,但是感觉对vnc viewer也是一样)
workaround (临时方案)
就在xshell里面拷贝粘贴就行了,我本身就在服务器中就不怎么用中文。主要是写代码。所以没必要这么考究。
(如果实在需要在服务器ubuntu里面写中文,直接装中文输入法就行。)
小结
以上
创作结束时间:2021年8月3日11:59:25
额外参考:
- How to copy/paste text from remote system? https://askubuntu.com/questions/41273/how-to-copy-paste-text-from-remote-system
- vnc viewer复制到linux乱码,VNC拷出来的文字变成了ASCII的unicode编码 https://blog.csdn.net/weixin_33305027/article/details/116803891