我在读取以阿拉伯语命名的文件时遇到问题。当我在 Ubuntu 上使用 Unity 时,它可以读取它们,但当我使用 KDE 时,它们就无法读取,除非我用拉丁字符重命名它们。我查看了一些我找到的解决方案,例如安装阿拉伯语语言包,或这一系列命令:
~# echo ar__AR.UTF8 >> /var/lib/locales/supported.d/local
~# more /var/lib/locales/supported.d/local
fr_FR.UTF-8 UTF-8
en_US.UTF-8 UTF-8
ru_RU.UTF-8 UTF-8
ar__AR.UTF8
~# sudo dpkg-reconfigure locales
perl: warning: Setting locale failed.
perl: warning: Please check that your locale settings:
LANGUAGE = "en:ar:fr:en",
LC_ALL = (unset),
LC_PAPER = "en_DZ.UTF-8",
LC_ADDRESS = "en_DZ.UTF-8",
LC_MONETARY = "en_DZ.UTF-8",
LC_NUMERIC = "en_DZ.UTF-8",
LC_TELEPHONE = "en_DZ.UTF-8",
LC_IDENTIFICATION = "en_DZ.UTF-8",
LC_MEASUREMENT = "en_DZ.UTF-8",
LC_TIME = "en_DZ.UTF-8",
LC_NAME = "en_DZ.UTF-8",
LANG = "en_DZ.UTF-8"
are supported and installed on your system.
perl: warning: Falling back to the standard locale ("C").
locale: Cannot set LC_CTYPE to default locale: No such file or directory
locale: Cannot set LC_MESSAGES to default locale: No such file or directory
locale: Cannot set LC_ALL to default locale: No such file or directory
Generating locales...
ar_AE.UTF-8... done
ar_BH.UTF-8... done
ar_DZ.UTF-8... done
ar_EG.UTF-8... done
ar_IN.UTF-8... done
ar_IQ.UTF-8... done
ar_JO.UTF-8... done
ar_KW.UTF-8... done
ar_LB.UTF-8... done
ar_LY.UTF-8... done
ar_MA.UTF-8... done
ar_OM.UTF-8... done
ar_QA.UTF-8... done
ar_SA.UTF-8... done
ar_SD.UTF-8... LC_MONETARY: value of field `int_curr_symbol' does not correspond to a valid name in ISO 4217
LC_ADDRESS: numeric country code `736' not valid
failed
ar_SY.UTF-8... done
ar_TN.UTF-8... done
ar_YE.UTF-8... done
Error: Bad entry 'ar__AR.UTF8 '
en_AG.UTF-8... done
en_AU.UTF-8... done
en_BW.UTF-8... done
en_CA.UTF-8... done
en_DK.UTF-8... done
en_GB.UTF-8... done
en_HK.UTF-8... done
en_IE.UTF-8... done
en_IN.UTF-8... done
en_NG.UTF-8... done
en_NZ.UTF-8... done
en_PH.UTF-8... done
en_SG.UTF-8... done
en_US.UTF-8... done
en_ZA.UTF-8... done
en_ZM.UTF-8... done
en_ZW.UTF-8... done
fr_BE.UTF-8... done
fr_CA.UTF-8... done
fr_CH.UTF-8... done
fr_FR.UTF-8... done
fr_LU.UTF-8... done
ru_RU.UTF-8... up-to-date
Generation complete.
我该如何解决这个问题?我不想浏览我的文件并更改其名称,或者返回 Unity,我喜欢 KDE。
答案1
您设置了无效的区域设置名称 - 没有“en_DZ.UTF-8”之类的东西 - 这使得您的系统回退到非 UTF-8 的“C”区域设置。这可能是导致您出现问题的原因。
我自己没有使用 Kubuntu,但你应该打开 GUI 进行语言设置。你可能在某个地方选择了阿尔及利亚作为国家。要获取有效的语言环境名称,请将其更改为例如美国或英国。
接下来你最好删除以下错误的行/var/lib/locales/supported.d/local
:
sudo sed -i '/ar__AR/d' /var/lib/locales/supported.d/local
然后注销并重新登录。
最后重新生成你的语言环境:
sudo locale-gen --purge
这次,输出应该没有错误消息,除了有关 ar_SD.UTF-8 中的 LC_MONETARY 和 LC_ADDRESS 的消息之外。