Add a encoding parameter for readline

Cleaned up pull request of #129 by @crenovator and @genedna.

Optionally allows setting of alternative Buffer encodings besides UTF-8.