rusterlium / rusterlium/html5ever_elixir
Parsing non-UTF-8 pages
Nobody has claimed this yet.
- Dominant language
- HTML
- Stars
- 87
- Forks
- 31
- Avg merge
- 3h 45m
- Merged PRs (30d)
- 3
Description
Parsing pages not written in UTF-8 currently produces errors:
> %HTTPoison.Response{body: body} = HTTPoison.get!("http://manybooks.net/index.xml")
> Html5ever.parse(body)
thread '<unnamed>' panicked at 'called `Result::unwrap()` on an `Err` value: Utf8Error { valid_up_to: 4070 }', src/libcore/result.rs:859
note: Run with `RUST_BACKTRACE=1` for a backtrace.
{:error, "called `Result::unwrap()` on an `Err` value: Utf8Error { valid_up_to: 4070 }"}
In this case this XML feed has the encoding in the xml preeamble:
<?xml version="1.0" encoding="iso-8859-1"?>
<rss version="2.0">
...
Can I get around this problem or can the library be fixed to handle this situation?
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reproducing the failure through Html5ever.parse with the HTTPoison response body from the manybooks.net XML feed. Read the parser input path and the Rustler boundary to determine how the XML encoding preamble is handled. Done means the ISO-8859-1 example parses without a panic or UTF-8 error.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- elixir, rust
- Domain
- backend
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 25/100