Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

PHP is still full of awkward decisions.

One that baffles me is that 8.0 changed it so all scripts default to a "C" (i.e. english, ascii-only) locale. [0]

So this is now a scripting language that requires you to call `setlocale` for every script manually.

Contrast python, which tries to fix the locale so it's at least UTF-8 aware. [1]

[0]: From https://www.php.net/manual/en/migration80.incompatible.php "The default locale on startup is now always "C". No locales are inherited from the environment by default. Previously, LC_ALL was set to "C", while LC_CTYPE was inherited from the environment. However, some functions did not respect the inherited locale without an explicit setlocale() call. An explicit setlocale() call is now always required if a locale component should be changed from the default. "

[1]: https://www.python.org/dev/peps/pep-0538/




It seems awkward, but it's not. It picks picks a deterministic default instead of a "whatever you have in your OS environment".

It practice all these env config initialization things are handled by the php.ini, and/or by a framework.

(Plus using the mb_string ext is how any minimally sane string handling is done in PHP nowadays.)

Yes, probably in ~10 years the PHP world too will move to a unicode by default setup :)

But hey, progress!




Consider applying for YC's Fall 2025 batch! Applications are open till Aug 4

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: