What I think in addition to what Atkinso writes: If you just strip arbitrary bytes that happen to be equal in value to the numeric value of ASCII control characters or whitespace, how can you be sure that you don’t destroy valid non-whitespace unicode symbols?

You can’t! This will work only of you have actually ASCII input.

  • Markaos@discuss.tchncs.de
    link
    fedilink
    arrow-up
    1
    ·
    3 days ago

    it’s incorrect bc it destroys multibyte characters

    It doesn’t. As the poster two levels up said, all bytes that don’t represent an ASCII character have the high bit set, even the follow-up bytes in multibyte sequences. So the condition b >= 32 will match and preserve them.