detect character encoding (closes #9)