title: How to convert inline SVG on the server?
body: <p>I need to set the resulting inline SVG as a <code>background-image</code> on some other element as shown <a href="http://jsfiddle.net/CT3Za/" rel="nofollow">in this example</a>. As this works only in Chrome I need some other way to set the client drawn SVG as <code>background-image</code>.</p>
  
  <p>Another, maybe simpler inline SVG, is the RaphaelJS demo as <a href="http://raphaeljs.com/playground.html" rel="nofollow">seen here</a>. </p>
  
  <pre><code>&lt;svg height="480" version="1.1" width="640" xmlns="http://www.w3.org/2000/svg" style="overflow: hidden; position: relative; top: -0.90625px;"&gt;&lt;desc style="-webkit-tap-highlight-color: rgba(0, 0, 0, 0);"&gt;Created with Raphaël 2.1.0&lt;/desc&gt;&lt;defs style="-webkit-tap-highlight-color: rgba(0, 0, 0, 0);"&gt;&lt;/defs&gt;&lt;rect x="0" y="0" width="640" height="480" r="10" rx="10" ry="10" fill="#ffffff" stroke="none" style="-webkit-tap-highlight-color: rgba(0, 0, 0, 0);"&gt;&lt;/rect&gt;&lt;circle cx="320" cy="240" r="60" fill="#223fa3" stroke="#000000" style="-webkit-tap-highlight-color: rgba(0, 0, 0, 0); stroke-opacity: 0.5;" stroke-width="80" stroke-opacity="0.5"&gt;&lt;/circle&gt;&lt;/svg&gt;
  </code></pre>
  
  <p>Is it possible to convert inline SVG (created by RaphaelJS on the client) on the server to  a "real" SVG file? It's a Windows (.NET/c#) server environment on which the conversion should take place.</p>
  
  <p><strong>Edit</strong></p>
  
  <p>As Robert Longson noticed I was missing the <code>charset=</code> and additionally it looks like I used the wrong function (<code>encodeURI</code>) to encode the inline SVG.</p>
  
  <p>Just for the sake of completeness here the code fragment for setting the <code>background-image</code> that works for me</p>
  
  <pre><code>var svgUrl = 'url("data:image/svg+xml;charset=utf8,' + encodeURIComponent($('#raphaelPaper').html()) + '")';
  $('#pictureDummy').css('background-image', svgUrl);
  </code></pre>