~bzr-pqm/bzr/bzr.dev

6002.1.1 by John Arbash Meinel, Jelmer Vernooij
Add documentation on handling of special characters in URLs.
1
Special character handling in URLs
2
==================================
3
6002.1.6 by Jelmer Vernooij
Some clarifications.
4
Bazaar allows locations to be specified in multiple ways, either:
5
6
 * Fully qualified URLs
7
8
 * File system paths, relative or absolute
9
10
Internally bzr treats all locations as URLs. For any file system paths
11
that are specified it will automatically determine the appropriate URL
12
representation, and escape special characters where necessary.
6002.1.3 by Jelmer Vernooij
Improvements.
13
14
There are a few characters which have special meaning in URLs and need careful
15
handling to avoid ambiguities. Characters can be escaped with a % and a hex
6002.1.6 by Jelmer Vernooij
Some clarifications.
16
value in URLs. Any non-ASCII characters in a file path will automatically be
17
urlencoded when the path is converted to a URL.
6002.1.3 by Jelmer Vernooij
Improvements.
18
6002.1.4 by Jelmer Vernooij
More clarifications.
19
URLs represent non-ASCII characters in an encoding defined by the server, but
6002.1.3 by Jelmer Vernooij
Improvements.
20
usually UTF-8.  The % escapes should be of the UTF-8 bytes.  Bazaar tries to be
21
generous in what it accepts as a URL and to print them in a way that
22
will be readable.
6002.1.1 by John Arbash Meinel, Jelmer Vernooij
Add documentation on handling of special characters in URLs.
23
6002.1.4 by Jelmer Vernooij
More clarifications.
24
For example, if you have a directory named '/tmp/%2False' these are all valid
25
ways of accessing the content (0x2F, or 47, is the ASCII code for forward slash)::
6002.1.2 by Jelmer Vernooij
Clarify relative paths.
26
6002.1.1 by John Arbash Meinel, Jelmer Vernooij
Add documentation on handling of special characters in URLs.
27
  cd /tmp
28
  bzr log /tmp/%2False
29
  bzr log %2False
6002.1.3 by Jelmer Vernooij
Improvements.
30
  bzr log file:///tmp/%252False
31
  bzr log file://localhost/tmp/%252False
32
  bzr log file:%252False
6002.1.1 by John Arbash Meinel, Jelmer Vernooij
Add documentation on handling of special characters in URLs.
33
6002.1.3 by Jelmer Vernooij
Improvements.
34
These are valid but do not refer to the same file::
6002.1.4 by Jelmer Vernooij
More clarifications.
35
6002.1.3 by Jelmer Vernooij
Improvements.
36
  bzr log file:///tmp/%2False (refers to a file called /tmp/\/alse)
37
  bzr log %252False (refers to a file called /tmp/%252False)
6002.1.1 by John Arbash Meinel, Jelmer Vernooij
Add documentation on handling of special characters in URLs.
38
39
Comma also has special meaning in URLs, because it denotes `segment parameters`_
40
6002.1.3 by Jelmer Vernooij
Improvements.
41
_`segment parameters`: http://www.ietf.org/rfc/rfc3986.txt (section 3.3)
6002.1.7 by Jelmer Vernooij
Document comma's.
42
43
Comma is also special in any file system paths that are specified. To use a literal
44
comma in a file system path, specify a URL and URL encode the comma::
45
46
  bzr log foo,branch=bla # path "foo" with the segment parameter "branch" set to "bla"
47
  bzr log file:foo%2Cbranch=bla # path "foo,branch=bla"
6037.1.3 by Jelmer Vernooij
Add another file: relative url to url-special-chars.txt.
48
  bzr log file:foo,branch=bla # path "foo" with segment parameter "branch" set to "bla"