为什么在与UNIX / Linux环境交互时使用UTF-8编码? [英] Why is it that UTF-8 encoding is used when interacting with a UNIX/Linux environment?
本文介绍了为什么在与UNIX / Linux环境交互时使用UTF-8编码?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
UTF-8
的其他编码(最引人注目的是 UTF-16
)? 编辑:通过交互,我主要是指 shell
和 libc
。
解决方案
部分原因是文件系统期望NUL('\0')字节终止文件名,因此UTF-16会工作不好您必须修改很多代码才能进行更改。
I know it is customary, but why? Are there real technical reasons why any other way would be a really bad idea or is it just based on the history of encoding and backwards compatibility? In addition, what are the dangers of not using UTF-8
, but some other encoding (most notably, UTF-16
)?
Edit : By interacting, I mostly mean the shell
and libc
.
解决方案
Partly because the file systems expect NUL ('\0') bytes to terminate file names, so UTF-16 would not work well. You'd have to modify a lot of code to make that change.
这篇关于为什么在与UNIX / Linux环境交互时使用UTF-8编码?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文