Skip to content

Commit

Permalink
Escape special characters in symbols in URL
Browse files Browse the repository at this point in the history
Some special characters (e.g. "&") in symbols would make the URL
invalid. Escape all the special characters in the symbols before
creating the URL.

Tested with ^GSPC and it still worked. Hopefully other symbols with
special characters that worked still continue to do so.

Fixes #324.
  • Loading branch information
joshuaulrich committed Feb 14, 2021
1 parent 699f953 commit a2aad16
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion R/getQuote.R
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,9 @@ function(Symbols,what=standardQuote(),...) {
cat("...done\n")
return(df)
}
SymbolsString <- paste(Symbols,collapse=',')
# escape symbols that have special characters
escapedSymbols <- sapply(Symbols, URLencode, reserved = TRUE)
SymbolsString <- paste(escapedSymbols, collapse = ',')
if(inherits(what, 'quoteFormat')) {
QF <- what[[1]]
QF.names <- what[[2]]
Expand Down

0 comments on commit a2aad16

Please sign in to comment.