[svn.haxx.se] · SVN Dev · SVN Users · SVN Org · TSVN Dev · TSVN Users · Subclipse Dev · Subclipse Users · this month's index

Re: File names encoding

From: Daniel Rall <dlr_at_collab.net>
Date: 2007-01-30 21:44:00 CET

On Tue, 30 Jan 2007, Michael Sinz wrote:

> MONTEUX Eric wrote:
> >
> >I am currently developping a subversion client in C++.
> >I have a problem with blank characters existing in my file names.
> >The svn api says the url of such files is malformed.
> >
> >How can I encode the file names in such a way that it is considered as a
> >valid url ?
>
> URL encoding has the file name escaped as per RFC2396. This is "%xx" where
> the xx is the hex code for the character. For example, "%20" would be a
> space and thus a file of "one space" would be "one%20space"
>
> All non-alpha-numeric characters or special path characters should be
> encoded.
> See http://www.ietf.org/rfc/rfc2396.txt
>
> [...]
>
> >I also watched inside the tortoiseSvn source code, but I can't use it
> >since I need a portable (windows / linux) implementation.
>
> I don't remember where the function is right now (I have been playing on
> the Java side a bit too much lately and know where to do it there) but
> a conversion from UTF8 path into URL encoding should be readily available.
>
> See http://www.w3.org/International/O-URL-code.html

From svn_path.h:

/** Return a URI-encoded copy of @a path, allocated in @a pool. */
const char *svn_path_uri_encode(const char *path, apr_pool_t *pool);

  • application/pgp-signature attachment: stored
Received on Tue Jan 30 21:44:11 2007

This is an archived mail posted to the Subversion Dev mailing list.