Allow to choose encoding of input string

close #24