Allow isprintable() util function to work with unicode

Fixes #6842