Extracting text from PDF with Ghostscript
<p>I am using Ghostscript 9.20 to extract the text from a PDF document that contains only two lines of text:</p>

<pre><code>Hello world…
A beautiful day!
</code></pre>

<p>The code applied is:</p>

<pre><code>gswin32c -sDEVICE=txtwrite -o output.txt input.pdf
</code></pre>

<p>However, the the output is:</p>

<pre><code>  䠀攀氀氀漀 眀漀爀氀搀☠ 
  䄀 戀攀愀甀琀椀昀甀氀 搀愀礀℀ 
</code></pre>

<p>What is going on and how do I fix it?</p>