remove BOM
encode input in utf-8