move encoding-stuff to separate source
clean up sockets a bit
whoops: compose ch1+ch2 rather than ch+ch2

We set ch to the unicode replacement character, and we don't want
to compose that into our resulting code-point :S