added the possibility to choose the encoding in the options