Re: [R] "Special" characters in URI

From: Gregor GORJANC <gregor.gorjanc_at_bfro.uni-lj.si>
Date: Tue 03 May 2005 - 20:54:09 EST

Prof Brian Ripley wrote:
> On Tue, 3 May 2005, Gorjanc Gregor wrote:
>

>> I am crossposting this to R-help and BioC, since it is relevant to both
>> groups.

>
> I don't see the relevance to R-help. But the answer to your subject is
Is it more rellevant for R-devel?

> unambiguous: valid URLs do not contain `special' characters -- they must
> be encoded. See RFC1738 at e.g. ftp://ftp.funet.fi/pub/doc/rfc/rfc1738.txt
Yes, I understand that completely and I just wanted to know how other handle or have solved this issue. Having this in mind I am looking forward to your 'filePathToURL' function. Do you have any scratches of it already? What do you think about this scratch, which afcourse doesn't solve all "special" characters:

fixURLchar <- function(URL,

                       from = c(" ", "\"", ",", "#"),
                       to = c("%20", "%22", "%2c", "%23"))
{
  ## Checks
  if (length(from) != length(to))
    stop("Length of 'from' and 'to' must be the same")

  ## Core
  for (i in seq(along=from)) {
    URL <- gsub(pattern=from[i], replacement=to[i], x=URL)   }

  return(URL)
}

> At some point (probably 2.2.0) I intend to ensure that the mapping to
> file:// URLs that is done is a few places is encoded as necessary. This
> will likely result in a utility function filePathToURL or some such.
>

-- 
Lep pozdrav / With regards,
    Gregor Gorjanc

----------------------------------------------------------------------
University of Ljubljana
Biotechnical Faculty        URI: http://www.bfro.uni-lj.si/MR/ggorjan
Zootechnical Department     mail: gregor.gorjanc <at> bfro.uni-lj.si
Groblje 3                   tel: +386 (0)1 72 17 861
SI-1230 Domzale             fax: +386 (0)1 72 17 888
Slovenia, Europe
----------------------------------------------------------------------
"One must learn by doing the thing; for though you think you know it,
 you have no certainty until you try." Sophocles ~ 450 B.C.

______________________________________________
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Received on Tue May 03 20:59:15 2005

This archive was generated by hypermail 2.1.8 : Fri 03 Mar 2006 - 03:31:32 EST