我正在考虑将我的所有服务器语言环境更改为 C
"export LC_ALL=C"
这是一种常见的做法吗?
我在想这会对 LAMP 服务器产生任何副作用吗,或者我应该保留默认的“en_US.UTF-8”?
答案1
您可能需要编辑/etc/default/locale
以设置区域设置,因为您的导出命令只会影响当前环境。它不会影响已经运行的程序。
您提到的有关 grep 的问题几年前就已经修复了:
fixed in grep 2.7, released Sep 20, 2010
In multibyte locales, regular expressions including backreferences
no longer exhibit quadratic complexity (i.e., they are orders
of magnitude faster). [bug present since multi-byte character set
support was introduced in 2.5.2]
In UTF-8 locales, regular expressions including "." can be orders
of magnitude faster. For example, "grep ." is now twice as fast
as "grep -v ^$", instead of being immensely slower. It remains
slow in other multibyte locales. [bug present since multi-byte
character set support was introduced in 2.5.2]