title: Why is ColdFusion adding whitespace when I call a function in cfoutput?
body: <p>If I do something like this in ColdFusion:</p>
  
  <pre><code>&lt;cfoutput&gt;foo="#foo()#"&lt;/cfoutput&gt;
  </code></pre>
  
  <p>The resulting HTML has a space in front of it:</p>
  
  <pre><code>foo=" BAR"
  </code></pre>
  
  <p>However, if it is not a function call it works fine, i.e.:</p>
  
  <pre><code>&lt;cfset fooOut=foo() /&gt;
  &lt;cfoutput&gt;foo="#fooOut#"&lt;/cfoutput&gt;
  </code></pre>
  
  <p>Gives this output:</p>
  
  <pre><code>foo="BAR"
  </code></pre>
  
  <p>Where is this extra space coming from and is there anything I can do about it?</p>
  
  <hr>
  
  <p><strong>Edit</strong> To clarify, the space is not in the value returned by my <code>foo</code> function:</p>
  
  <pre><code>&lt;cffunction name="foo" access="public" returntype="string"&gt;
    &lt;cfreturn "BAR" /&gt;
  &lt;/cffunction&gt;
  </code></pre>
  
  <p>But I've also found that this doesn't happen with built-in functions, i.e.:</p>
  
  <pre><code>&lt;cfoutput&gt;"#UCase("bar")#"&lt;/cfoutput&gt;
  </code></pre>
  
  <p>Prints:</p>
  
  <pre><code>"BAR"
  </code></pre>
  
  <p>However, it does happen if I pass the output of my function to the built-in function (this part makes no sense to me). i.e.: </p>
  
  <pre><code>&lt;cfoutput&gt;"#UCase(foo())#"&lt;/cfoutput&gt;
  </code></pre>
  
  <p>Prints:</p>
  
  <pre><code>" BAR"
  </code></pre>