Reputation: 1602
I'm making crawling app. I want to parse some characters. But some pages are not UTF-8 charset.
I got page body and now I want to do some work with the body string. First of all, I should convert encoding to UTF-8 if the page encoding is not UTF-8.
How can I do?
Upvotes: 1
Views: 1587
Reputation: 54684
You can use the Erlang iconv library to do such conversions. It's easy!
iconv
installed on your system{:iconv, "~> 1.0.0"}
to deps and :iconv
to applications in mix.exs
:iconv.convert("euc-kr", "utf-8", "input")
You can find a list of supported encodings on the libiconv page or by running iconv --list
in the command line.
Upvotes: 2