Encode data sent to a socket

Taken from [the forum post](http://www.raspberrypi.org/forums/viewtopic.php?f=32&t=33349)

No testing set up for this yet but it seems like a sensible assumption `s` will be unicode at this point and `socket.send()` takes bytes.