Skip to content

Commit

Permalink
fix: make sure that it is clear that the strings are assumed to be va…
Browse files Browse the repository at this point in the history
…lid UTF-8. (#675)
  • Loading branch information
lemire authored May 27, 2024
1 parent a404fd8 commit 5357915
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
5 changes: 3 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ components (path, host, and so forth).
### Parsing & Validation
- Parse and validate a URL from an ASCII or UTF-8 string
- Parse and validate a URL from an ASCII or a valid UTF-8 string.
```cpp
ada::result<ada::url_aggregator> url = ada::parse<ada::url_aggregator>("https://www.google.com");
Expand Down Expand Up @@ -144,7 +144,8 @@ if(url) {
```

For simplicity, in the examples below, we skip the check because
we know that parsing succeeds.
we know that parsing succeeds. All strings are assumed to be valid
UTF-8 strings.

### Examples

Expand Down
5 changes: 4 additions & 1 deletion include/ada/parser.h
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,10 @@ struct url;
namespace ada::parser {

/**
* Parses a url.
* Parses a url. The parameter user_input is the input to be parsed:
* it should be a valid UTF-8 string. The parameter base_url is an optional
* parameter that can be used to resolve relative URLs. If the base_url is
* provided, the user_input is resolved against the base_url.
*/
template <typename result_type = ada::url_aggregator>
result_type parse_url(std::string_view user_input,
Expand Down

0 comments on commit 5357915

Please sign in to comment.