<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>Special character handling in URLs — Bazaar 2.7.0 documentation</title> <link rel="stylesheet" href="../_static/classic.css" type="text/css" /> <link rel="stylesheet" href="../_static/pygments.css" type="text/css" /> <script type="text/javascript"> var DOCUMENTATION_OPTIONS = { URL_ROOT: '../', VERSION: '2.7.0', COLLAPSE_INDEX: false, FILE_SUFFIX: '.html', HAS_SOURCE: true }; </script> <script type="text/javascript" src="../_static/jquery.js"></script> <script type="text/javascript" src="../_static/underscore.js"></script> <script type="text/javascript" src="../_static/doctools.js"></script> <link rel="shortcut icon" href="../_static/bzr.ico"/> <link rel="search" title="Search" href="../search.html" /> <link rel="top" title="Bazaar 2.7.0 documentation" href="../index.html" /> <link rel="up" title="Bazaar User Reference" href="index.html" /> <link rel="next" title="URL Identifiers" href="urlspec-help.html" /> <link rel="prev" title="Status Flags" href="status-flags-help.html" /> </head> <body role="document"> <div class="related" role="navigation" aria-label="related navigation"> <h3>Navigation</h3> <ul> <li class="right" style="margin-right: 10px"> <a href="urlspec-help.html" title="URL Identifiers" accesskey="N">next</a></li> <li class="right" > <a href="status-flags-help.html" title="Status Flags" accesskey="P">previous</a> |</li> <li><a href="http://bazaar.canonical.com/"> <img src="../_static/bzr icon 16.png" /> Home</a> | </li> <a href="http://doc.bazaar.canonical.com/en/">Documentation</a> | </li> <li class="nav-item nav-item-0"><a href="../index.html">Table of Contents (2.7.0)</a> »</li> <li class="nav-item nav-item-1"><a href="index.html" accesskey="U">Bazaar User Reference</a> »</li> </ul> </div> <div class="document"> <div class="documentwrapper"> <div class="bodywrapper"> <div class="body" role="main"> <div class="section" id="special-character-handling-in-urls"> <h1>Special character handling in URLs<a class="headerlink" href="#special-character-handling-in-urls" title="Permalink to this headline">ΒΆ</a></h1> <p>Bazaar allows locations to be specified in multiple ways, either:</p> <blockquote> <div><ul class="simple"> <li>Fully qualified URLs</li> <li>File system paths, relative or absolute</li> </ul> </div></blockquote> <p>Internally bzr treats all locations as URLs. For any file system paths that are specified it will automatically determine the appropriate URL representation, and escape special characters where necessary.</p> <p>There are a few characters which have special meaning in URLs and need careful handling to avoid ambiguities. Characters can be escaped with a % and a hex value in URLs. Any non-ASCII characters in a file path will automatically be urlencoded when the path is converted to a URL.</p> <p>URLs represent non-ASCII characters in an encoding defined by the server, but usually UTF-8. The % escapes should be of the UTF-8 bytes. Bazaar tries to be generous in what it accepts as a URL and to print them in a way that will be readable.</p> <p>For example, if you have a directory named ‘/tmp/%2False’ these are all valid ways of accessing the content (0x2F, or 47, is the ASCII code for forward slash):</p> <div class="highlight-default"><div class="highlight"><pre><span></span><span class="n">cd</span> <span class="o">/</span><span class="n">tmp</span> <span class="n">bzr</span> <span class="n">log</span> <span class="o">/</span><span class="n">tmp</span><span class="o">/%</span><span class="mi">2</span><span class="kc">False</span> <span class="n">bzr</span> <span class="n">log</span> <span class="o">%</span><span class="mi">2</span><span class="kc">False</span> <span class="n">bzr</span> <span class="n">log</span> <span class="n">file</span><span class="p">:</span><span class="o">///</span><span class="n">tmp</span><span class="o">/%</span><span class="mi">252</span><span class="kc">False</span> <span class="n">bzr</span> <span class="n">log</span> <span class="n">file</span><span class="p">:</span><span class="o">//</span><span class="n">localhost</span><span class="o">/</span><span class="n">tmp</span><span class="o">/%</span><span class="mi">252</span><span class="kc">False</span> <span class="n">bzr</span> <span class="n">log</span> <span class="n">file</span><span class="p">:</span><span class="o">%</span><span class="mi">252</span><span class="kc">False</span> </pre></div> </div> <p>These are valid but do not refer to the same file:</p> <div class="highlight-default"><div class="highlight"><pre><span></span><span class="n">bzr</span> <span class="n">log</span> <span class="n">file</span><span class="p">:</span><span class="o">///</span><span class="n">tmp</span><span class="o">/%</span><span class="mi">2</span><span class="kc">False</span> <span class="p">(</span><span class="n">refers</span> <span class="n">to</span> <span class="n">a</span> <span class="n">file</span> <span class="n">called</span> <span class="o">/</span><span class="n">tmp</span><span class="o">/</span>\<span class="o">/</span><span class="n">alse</span><span class="p">)</span> <span class="n">bzr</span> <span class="n">log</span> <span class="o">%</span><span class="mi">252</span><span class="kc">False</span> <span class="p">(</span><span class="n">refers</span> <span class="n">to</span> <span class="n">a</span> <span class="n">file</span> <span class="n">called</span> <span class="o">/</span><span class="n">tmp</span><span class="o">/%</span><span class="mi">252</span><span class="kc">False</span><span class="p">)</span> </pre></div> </div> <p>Comma also has special meaning in URLs, because it denotes <a class="reference internal" href="#segment-parameters">segment parameters</a></p> <p><span class="target" id="segment-parameters">segment parameters</span>: <a class="reference external" href="http://www.ietf.org/rfc/rfc3986.txt">http://www.ietf.org/rfc/rfc3986.txt</a> (section 3.3)</p> <p>Comma is also special in any file system paths that are specified. To use a literal comma in a file system path, specify a URL and URL encode the comma:</p> <div class="highlight-default"><div class="highlight"><pre><span></span><span class="n">bzr</span> <span class="n">log</span> <span class="n">foo</span><span class="p">,</span><span class="n">branch</span><span class="o">=</span><span class="n">bla</span> <span class="c1"># path "foo" with the segment parameter "branch" set to "bla"</span> <span class="n">bzr</span> <span class="n">log</span> <span class="n">file</span><span class="p">:</span><span class="n">foo</span><span class="o">%</span><span class="mi">2</span><span class="n">Cbranch</span><span class="o">=</span><span class="n">bla</span> <span class="c1"># path "foo,branch=bla"</span> <span class="n">bzr</span> <span class="n">log</span> <span class="n">file</span><span class="p">:</span><span class="n">foo</span><span class="p">,</span><span class="n">branch</span><span class="o">=</span><span class="n">bla</span> <span class="c1"># path "foo" with segment parameter "branch" set to "bla"</span> </pre></div> </div> </div> </div> </div> </div> <div class="sphinxsidebar" role="navigation" aria-label="main navigation"> <div class="sphinxsidebarwrapper"> <h4>Previous topic</h4> <p class="topless"><a href="status-flags-help.html" title="previous chapter">Status Flags</a></p> <h4>Next topic</h4> <p class="topless"><a href="urlspec-help.html" title="next chapter">URL Identifiers</a></p> <div role="note" aria-label="source link"> <h3>This Page</h3> <ul class="this-page-menu"> <li><a href="../_sources/user-reference/url-special-chars-help.txt" rel="nofollow">Show Source</a></li> </ul> </div> <div id="searchbox" style="display: none" role="search"> <h3>Quick search</h3> <form class="search" action="../search.html" method="get"> <div><input type="text" name="q" /></div> <div><input type="submit" value="Go" /></div> <input type="hidden" name="check_keywords" value="yes" /> <input type="hidden" name="area" value="default" /> </form> </div> <script type="text/javascript">$('#searchbox').show(0);</script> </div> </div> <div class="clearer"></div> </div> <div class="related" role="navigation" aria-label="related navigation"> <h3>Navigation</h3> <ul> <li class="right" style="margin-right: 10px"> <a href="urlspec-help.html" title="URL Identifiers" >next</a></li> <li class="right" > <a href="status-flags-help.html" title="Status Flags" >previous</a> |</li> <li><a href="http://bazaar.canonical.com/"> <img src="../_static/bzr icon 16.png" /> Home</a> | </li> <a href="http://doc.bazaar.canonical.com/en/">Documentation</a> | </li> <li class="nav-item nav-item-0"><a href="../index.html">Table of Contents (2.7.0)</a> »</li> <li class="nav-item nav-item-1"><a href="index.html" >Bazaar User Reference</a> »</li> </ul> </div> <div class="footer" role="contentinfo"> © Copyright 2009-2011 Canonical Ltd. Created using <a href="http://sphinx-doc.org/">Sphinx</a> 1.4.9. </div> </body> </html>