OSX 10.7.5 UTF-8 encoding over ssh

2019-08-30 05:07发布

问题:

I connect to a remote linux machine over ssh and when I view a remote text file with cat command, I see incorrect incoding. It's supposed to show äöü etc, but shows garbage. I tried a luit trick,

luit -encoding "UTF-8" ssh remotehost

but on Mac it gives error

"Couldn't copy terminal settings"

Which is a known issue and apparently Apple is not going to fix it on Lion. So I am stuck now. What are the alternatives?

回答1:

This is a bug in Mac OS that causes tcsetattr to fail on ptys opened with posix_openpt. The workaround is to use the openpty function instead.

I suggest that you grab the upstream sources and recompile with posix_openpt disabled.