(#19128) Make PSON handle unicode characters

This is mostly copied code from json_pure 1.7.7