unify platform encoding.c, support all

Closes GH #1120.
Get support for other platform encodings for free.