Forum How do I...?

Strange (Â) control characters

cbourne
Hi,

I'm using Ruby to pass the following html directly to Prince using stdin:-
<div class="code panel" style="border-style: solid;border-width: 1px;">
<div class="codeHeader panelHeader" style="border-bottom-width: 1px;border-bottom-style: solid;"><b>FTP Policy with retry tags</b></div>
<div class="codeContent panelContent">
<pre class="code-xml"><span class="code-tag">&lt;ftpDelivery host='10.1.3.43' port='990' username='espftp' passphrase='lexicon' directory='/' retry-times='5' retry-interval='3'&gt;</span>
   <span class="code-tag">&lt;connectionTimeout&gt;</span>60<span class="code-tag">&lt;/connectionTimeout&gt;</span>
   <span class="code-tag">&lt;transferMode&gt;</span>passive<span class="code-tag">&lt;/transferMode&gt;</span>
   <span class="code-tag">&lt;transferType&gt;</span>binary<span class="code-tag">&lt;/transferType&gt;</span>
   <span class="code-tag">&lt;verify&gt;</span>false<span class="code-tag">&lt;/verify&gt;</span>
   <span class="code-tag">&lt;sslAccept&gt;</span>auto<span class="code-tag">&lt;/sslAccept&gt;</span>
<span class="code-tag">&lt;/ftpDelivery&gt;</span></pre>
</div>
</div>


However, the output .pdf always includes some strange control (Â) characters:
<ftpDelivery host='10.1.3.43' port='990' username='espftp' passphrase='lexicon' Â Â <connectionTimeout>60</connectionTimeout>
  <transferMode>passive</transferMode>
  <transferType>binary</transferType>
  <verify>false</verify>
  <sslAccept>auto</sslAccept>
</ftpDelivery>


If I pipe the html in to Prince directly from the command line using the following command:
echo '<div class="code panel" style="border-style: solid;border-width: 1px;">
<div class="codeHeader panelHeader" style="border-bottom-width: 1px;border-bottom-style: solid;"><b>FTP Policy with retry tags</b></div>
<div class="codeContent panelContent">
<pre class="code-xml"><span class="code-tag">&lt;ftpDelivery host='10.1.3.43' port='990' username='espftp' passphrase='lexicon' directory='/' retry-times='5' retry-interval='3'&gt;</span>
   <span class="code-tag">&lt;connectionTimeout&gt;</span>60<span class="code-tag">&lt;/connectionTimeout&gt;</span>
   <span class="code-tag">&lt;transferMode&gt;</span>passive<span class="code-tag">&lt;/transferMode&gt;</span>
   <span class="code-tag">&lt;transferType&gt;</span>binary<span class="code-tag">&lt;/transferType&gt;</span>
   <span class="code-tag">&lt;verify&gt;</span>false<span class="code-tag">&lt;/verify&gt;</span>
   <span class="code-tag">&lt;sslAccept&gt;</span>auto<span class="code-tag">&lt;/sslAccept&gt;</span>
<span class="code-tag">&lt;/ftpDelivery&gt;</span></pre>
</div>
</div>' | prince - -i html -o out.pdf


The resulting PDF is correct:-
<ftpDelivery host=10.1.3.43 port=990 username=espftp passphrase=lexicon directory=/ <connectionTimeout>60</connectionTimeout>
    <transferMode>passive</transferMode>
    <transferType>binary</transferType>
    <verify>false</verify>
    <sslAccept>auto</sslAccept>
</ftpDelivery>


Obviously this is a Ruby issue, but I would be grateful if anybody can shed some light on the cause of the problem.

Best Regards,

Carl
mikeday
Tabs perhaps? Can you capture the exact HTML that you are generating, eg. pipe it to a file, and email it to me? (mikeday@yeslogic.com)
cbourne
Mike suggested that the HTML meta tag should be specified in the header e.g.

<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">

This sorted the problem for me.

Carl