OS X 终端 UTF-8 问题 [英] OS X Terminal UTF-8 issues

查看:26
本文介绍了OS X 终端 UTF-8 问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

好的,所以我终于在 15 年的 linux 之后给自己买了一台 MacBook Air.在我得到它之前,我最关心的是 UTF-8 支持,因为无论我是从 windows 还是 mac 客户端发送给我的文件,总是存在编码问题,而在 ubuntu 上,我可以确保所有输出无论什么程序都会生成完美的 utf-8 编码数据.

Okay, so I finally got myself a MacBook Air after 15 years of linux. And before I got it my big concern was UTF-8 support because no matter if I get files sent to me from windows or mac-clients theres always issues with encoding, while on ubuntu I can be sure that all output no matter what program will produce perfect utf-8 encoded data.

现在在我使用 OS X 的第二天(今天),我沮丧地撕心裂肺.为什么?

And now on my second day (today) with OS X Im tearing my hair of by frustration. Why?

当我打开 Nano 并在其中输入一些瑞典字符(如 ÅÄÖ)时,它会在行尾显示空白字符(我猜这是每个字符中的另一个字节)

When I open Nano and type some swedish characters like ÅÄÖ in it, it puts out blank characters at the end of the line (which i guess is the other byte in each character)

当我打开 python 并尝试使用瑞典字符时,它根本不输出任何内容

When I open python and try using swedish characters, it does not output anything at all

当我通过 SSH 连接到 Ubuntu 服务器时,我无法在 bash 中输入 åäö,它在 VIM 中很难工作(仍然通过 SSH).并且在 nano 退格键不起作用,但如果在终端首选项中选中删除发送 ctrl+H"框,退格键开始在 nano 中工作,但在 VIM 中停止工作.

When I connect to a Ubuntu server trough SSH I cant type åäö in bash, tough it works in VIM (still trough SSH). And in nano backspace does not work, but if check the box "Delete sends ctrl+H" in the Terminal preferences, backspace starts working in nano but stops working in VIM.

我尝试在终端首选项中取消选中所有其他编码,然后取消选中 UTF-8,但这似乎也不起作用.

I've tried unchecking all other encodings then UTF-8 in terminal preferences but that does not seem to work either.

我敢肯定,每个非美国人都必须有同样的问题,所以我要解决这些问题吗?我只想要完整的 UTF-8 支持... :'(

I'm sure that every non US-person must have the same issues, so hove do I fix them? I just want full UTF-8 support... :'(

推荐答案

对我来说,这有帮助:我在终端的本地 shell 上检查了语言环境

For me, this helped: I checked locale on my local shell in terminal

$ locale
LANG="cs_CZ.UTF-8"
LC_COLLATE="cs_CZ.UTF-8"

然后通过 ssh 连接到我正在使用的任何远程主机并以 root 身份编辑文件/etc/profile - 最后我添加了一行:

Then connected to any remote host I am using via ssh and edited file /etc/profile as root - at the end I added line:

export LANG=cs_CZ.UTF-8

下次连接后,它可以在 bash、ls 和 nano 中正常工作.

After next connection it works fine in bash, ls and nano.

这篇关于OS X 终端 UTF-8 问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆