if it also trims other non-visible characters
I knew it also trimmed Tabs, but didn't realise it trimmed other characters too. ?
Just tested, and it trims all characters ASCII 0 (NUL) thru to 32 (space).
Interestingly, it doesn't trim ASCII 127 (DEL), but maybe that's not regarded as a control character in Unicode.
Nor does it trim any of the Unicode special spaces (non-breaking, thin, half, zero-width, etc).
Apparently you and I were just a tiny bit behind the times ? :
Trim removes all the characters that are considered as white space characters. This includes all characters with code point smaller than 21.
The 21 is technically correct, but I feel it would have been better as "code point 32 and smaller".