Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make URLdecode optional #5

Closed
chainsawriot opened this issue Sep 22, 2023 · 0 comments
Closed

Make URLdecode optional #5

chainsawriot opened this issue Sep 22, 2023 · 0 comments

Comments

@chainsawriot
Copy link
Collaborator

Sometimes, I might want to have those %.

ada_url_parse <- function(url, decode = TRUE) {
    url <- stringi::stri_enc_toutf8(url)
    url_parsed <- Rcpp_ada_parse(url, nchar(url, type = "bytes"))
    if (isTRUE(decode)) {
      return(lapply(url_parsed, URLdecode))
    }
    return(url_parsed)
}
ada_url_parse("https://www.google.co.jp/search?q=ドイツ")$search
## [1] "?q=ドイツ"
ada_url_parse("https://www.google.co.jp/search?q=ドイツ", decode = FALSE)$search
## [1] "?q=%E3%83%89%E3%82%A4%E3%83%84"
@chainsawriot chainsawriot changed the title Make URLdecode Make URLdecode optional Sep 22, 2023
schochastics added a commit that referenced this issue Sep 22, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant