Encode strings to UTF-8 for URLencode
Fixes umlaut queries on windows.
Resolves #3
Change-Id: Ic2ec22a595b5e167abbf374ce4c8e8375837f0b9
diff --git a/R/KorAPCorpusStats.R b/R/KorAPCorpusStats.R
index 8d9545a..8c4ad47 100644
--- a/R/KorAPCorpusStats.R
+++ b/R/KorAPCorpusStats.R
@@ -44,7 +44,7 @@
url <-
paste0(kco@apiUrl,
'statistics?cq=',
- URLencode(vc, reserved = TRUE))
+ URLencode(enc2utf8(vc), reserved = TRUE))
log.info(verbose, "Getting size of virtual corpus \"", vc, "\"", sep = "")
res <- apiCall(kco, url)
log.info(verbose, ": ", res$tokens, " tokens\n")
diff --git a/R/KorAPQuery.R b/R/KorAPQuery.R
index 230eb24..0b07106 100644
--- a/R/KorAPQuery.R
+++ b/R/KorAPQuery.R
@@ -168,8 +168,8 @@
}
request <-
paste0('?q=',
- URLencode(query, reserved = TRUE),
- if (vc != '') paste0('&cq=', URLencode(vc, reserved = TRUE)) else '', '&ql=', ql)
+ URLencode(enc2utf8(query), reserved = TRUE),
+ if (vc != '') paste0('&cq=', URLencode(enc2utf8(vc), reserved = TRUE)) else '', '&ql=', ql)
webUIRequestUrl <- paste0(kco@KorAPUrl, request)
requestUrl <- paste0(
kco@apiUrl,