It seems that the
strings command now honours the locale settings in the environment, in particular
This variable determines the locale category for character handling
functions, such as tolower(), toupper() and isalpha(). This
environment variable determines the interpretation of sequences of
bytes of text data as characters (for example, single- as opposed to
multi-byte characters), the classification of characters (for example,
alpha, digit, graph) and the behaviour of character classes.
Additional semantics of this variable, if any, are
C restores the previous behaviour:
% cat /dev/urandom | LC_CTYPE=C strings -n 16
An alternative approach (taken from Shell Script /dev/urandom on Stack Overflow with minor modifications) is to filter out non-printable characters with the
tr tool and take the first 16 characters with
% cat /dev/urandom | LC_CTYPE=C tr -dc '[:print:]' | dd bs=16 count=1 2> /dev/null
This is much faster because it does not wait for 16 consecutive printable characters from the random source.