Fixes PSK encoding to not crash on non ascii characters.