Detect encoding

may resolve #272

It works for me but should be tested on other systems.

Anyone should test if special characters are imported correctly now!