title: Postgres: After converting from bytea to varchar '\r' remains
body: <p>I have a table which contains xml file as binary data. The xmls contains "\r\n" characters as "\015\012" in bytea. I need to change the column type from bytea to varchar.</p>
  
  <p>I run:</p>
  
  <pre><code>ALTER TABLE my_table ALTER COLUMN xml_data TYPE VARCHAR;
  UPDATE my_table SET xml_data = convert_from(xml_data::bytea, 'UTF8');
  </code></pre>
  
  <p>And it works for linux. But on Windows it converts '\015' to "\r" (two characters). So I have something like that in the result:</p>
  
  <pre><code>&lt;field&gt;...&lt;/field&gt;\r
  &lt;field&gt;...&lt;/field&gt;
  </code></pre>
  
  <p>Maybe there is an proper method to convert binary data to UTF?</p>