Meta Engineer?

This is available as Locale\bytes in the www repository.

Retrieve a fixed locale suitable for byte-based operations

namespace HH\Lib\Locale;

function bytes(): Locale;

This is similar to the "C" locale, also known as the "POSIX" or "en_US_POSIX" locale; it does not vary based on user/environment/machine settings.

It differs from the real "C" locale in that it is usable on strings that contain null bytes; for example, Str\length_l(Locale\bytes(), "foo\0bar") will return 7, instead of 3. The behavior is equivalent if the strings are well-formed.


  • Locale