PLINK将字符集转换为UTF-8(utf8)

时间:2022-10-21 17:19:18

Does anyone know how to configure the character set translation on plink (the command line version of Putty) to UTF-8? I'm trying to SSH to a Linux server whose character set configuration is UTF-8.

有谁知道如何在plink(Putty的命令行版本)上配置字符集转换为UTF-8?我正在尝试SSH到一个字符集配置为UTF-8的Linux服务器。

This can be easily achieved via Putty, but I can't seem to find that command line option on Plink...

这可以通过Putty轻松实现,但我似乎无法在Plink上找到命令行选项...

2 个解决方案

#1


You can't find an option because plink doesn't do the character set translation - that's handled by the windows command window. To change the windows command window's character set translation before you start plink use the command "chcp".

你找不到一个选项,因为plink没有进行字符集转换 - 这是由windows命令窗口处理的。要在启动plink之前更改Windows命令窗口的字符集转换,请使用命令“chcp”。

To get utf-8, you'll need to first change the console window's font to "Lucida Console". Then, try "chcp 65001".

要获得utf-8,您需要先将控制台窗口的字体更改为“Lucida Console”。然后,尝试“chcp 65001”。

One caveat - I've found that there's something incredibly slow and inefficient about the windows console when it's doing utf-8 such that if you send data too quickly, plink will blow up and say "A device attached to the system is not functioning".

一个警告 - 我发现当它执行utf-8时,Windows控制台有一些非常缓慢和低效的东西,如果你发送数据太快,plink就会爆炸并说“连接到系统的设备无法运行” 。

However, I have to ask - why are you doing this? You should be using putty for anything interactive and for anything non-interactive, if you're redirecting output into a file the translation that the windows console has in effect at the time doesn't matter. The file is then in utf-8, and whatever windows program you're opening it in needs to be told that.

但是,我不得不问 - 你为什么要这样做?您应该使用putty进行任何交互式操作以及任何非交互式操作,如果您将输出重定向到文件中,那么Windows控制台当时有效的翻译无关紧要。然后该文件在utf-8中,无论你打开它的任何Windows程序都需要被告知。

#2


You could also configure a PuTTY session as desired and load it via plink:

您还可以根据需要配置PuTTY会话并通过plink加载它:

plink.exe -load my_session -l my_user_name -pw my_password <your command>

#1


You can't find an option because plink doesn't do the character set translation - that's handled by the windows command window. To change the windows command window's character set translation before you start plink use the command "chcp".

你找不到一个选项,因为plink没有进行字符集转换 - 这是由windows命令窗口处理的。要在启动plink之前更改Windows命令窗口的字符集转换,请使用命令“chcp”。

To get utf-8, you'll need to first change the console window's font to "Lucida Console". Then, try "chcp 65001".

要获得utf-8,您需要先将控制台窗口的字体更改为“Lucida Console”。然后,尝试“chcp 65001”。

One caveat - I've found that there's something incredibly slow and inefficient about the windows console when it's doing utf-8 such that if you send data too quickly, plink will blow up and say "A device attached to the system is not functioning".

一个警告 - 我发现当它执行utf-8时,Windows控制台有一些非常缓慢和低效的东西,如果你发送数据太快,plink就会爆炸并说“连接到系统的设备无法运行” 。

However, I have to ask - why are you doing this? You should be using putty for anything interactive and for anything non-interactive, if you're redirecting output into a file the translation that the windows console has in effect at the time doesn't matter. The file is then in utf-8, and whatever windows program you're opening it in needs to be told that.

但是,我不得不问 - 你为什么要这样做?您应该使用putty进行任何交互式操作以及任何非交互式操作,如果您将输出重定向到文件中,那么Windows控制台当时有效的翻译无关紧要。然后该文件在utf-8中,无论你打开它的任何Windows程序都需要被告知。

#2


You could also configure a PuTTY session as desired and load it via plink:

您还可以根据需要配置PuTTY会话并通过plink加载它:

plink.exe -load my_session -l my_user_name -pw my_password <your command>