title: Why Uri Class Trim the Trailing Tab Character
body: <p>I have the following code:</p>
  <pre><code>using System;
                      
  public class Program
  {
      public static void Main()
      {
          // &quot;http://example.com/a&quot; length is 20
          var u1 = new Uri(&quot;http://example.com/a&quot; + &quot;\t&quot;);
          var u2 = new Uri(&quot;http://example.com/a&quot; + &quot;\t&quot; + &quot;b&quot;);
          
          Console.WriteLine($&quot;{u1}, len = {u1.ToString().Length}&quot;);
          Console.WriteLine($&quot;{u1.AbsoluteUri}, len = {u1.AbsoluteUri.ToString().Length}&quot;);
          
          Console.WriteLine($&quot;{u2}, len = {u2.ToString().Length}&quot;);
          Console.WriteLine($&quot;{u2.AbsoluteUri}, len = {u2.AbsoluteUri.ToString().Length}&quot;);
      }
  }
  </code></pre>
  <p>The result is:</p>
  <pre><code>http://example.com/a, len = 20
  http://example.com/a, len = 20
  http://example.com/a    b, len = 22
  http://example.com/a%09b, len = 24
  </code></pre>
  <p>Questions:</p>
  <ol>
  <li>Why does <code>Uri</code> class trim the trailing tab?</li>
  <li><code>Uri</code> class encodes correctly <code>a\tb</code> to <code>a%09b</code>, but <code>a\t</code> to <code>a</code>. Do I have to explicitly encode this case when there is a trailing tab in the last URL segment,  before constructing a <code>Uri</code> class?</li>
  </ol>