readFile "file.html"
"start of the file... *** Exception: file.html: hGetContents: invalid argument (invalid code page byte sequence)
It’s a UTF-8 file created with notepad++… how can I read the file in haskell?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
By default, files are read in the system locale, so if you have a file using a non-standard encoding, you need to set the encoding of the file handle yourself.
should get you started. Note that this contains no error handling, the better way would thus be
or