support for unicode characters

Previously unicode characters being sent through a socket would result
in bamboo crashing.