added configurable encoding
fixed failed commit | added configurable encoding
removed unnecessary storage of encoding