R/URLencode.R

Defines functions URLencode

URLencode <- function(URL, reserved = FALSE) { 
    OK <- paste0("[^", if (!reserved) 
        "][!$&'()*+,;=:/?@#", "ABCDEFGHIJKLMNOPQRSTUVWXYZ", 
        "abcdefghijklmnopqrstuvwxyz0123456789._~-", "]") 
    x <- strsplit(URL, "")[[1L]] 
    z <- grep(OK, x) 
    if (length(z)) { 
        y <- sapply(x[z], function(x) paste0("%", toupper(as.character(charToRaw(x))), collapse = "")) 
        x[z] <- y 
    } 
    paste(x, collapse = "") 
} 
zhangxing-love/qingstor.signature documentation built on May 23, 2019, 9:35 a.m.