One can also check the encoding of the input using `io:getopts/0,1`, then use that to feed the input encoding in `unicode:characters_to_binary/3`. 

http://www.erlang.org/doc/man/io.html#getopts-1