[Nix-dev] How to get correct length of a string containing non-ascii characters

Erik Rybakken erik.rybakken at math.ntnu.no
Tue Jan 12 00:29:37 CET 2016


Hi,

In nix, when finding the length of a string containing non-ascii characters,
the number of bytes in the representation is returned, instead of the actual
number of characters:

> nix-repl> builtins.stringLength "å"
> 2

Is there any way to get the number of characters instead, or does this
require changes in the core language?

Best Regards,
Erik Rybakken


More information about the nix-dev mailing list