为什么在与UNIX / Linux环境交互时使用UTF-8编码? [英] Why is it that UTF-8 encoding is used when interacting with a UNIX/Linux environment?

查看:166
本文介绍了为什么在与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屋!

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