"PostgreSQL Bugs List" <pgsql-bugs(at)postgresql(dot)org> writes:
> Currently to_ascii changes all 's to spaces,
> which breaks everything.
The present to_ascii() code isn't very bright ... it doesn't know about
very many encodings, and it can't handle length-changing edits, which
is what you seem to need. Want to improve it and send a patch? See
src/backend/utils/adt/ascii.c.
regards, tom lane