Is it feasible to rely on setlocale, and rely on locales being installed?

一笑奈何 提交于 2019-11-29 10:07:53

If my examination of setlocale() is correct, the answer is: No and no. The range of installed locales varies, as does their name, and the availability of a certain locale ultimately cannot be predicted with total certainty.

You can check the return value of setlocale and at least check that it was installed. Otherwise you will have silent failures:

setlocale(LC_ALL, 'en_US') or die('Locale not installed');

Feasible, yes. Wise, not at all!

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!