title: Perl Text::CSV_XS Encoding Issues
body: <p>I'm having issues with Unicode characters in Perl.  When I receive data in from the web, I often get characters like <code>√¢¬Ä¬ú</code> or <code>√¢¬Ç¬¨</code>.  The first one is a quotation mark and the second is the Euro symbol.  </p>
  
  <p>Now I can easily substitute in the correct values in Perl and print to the screen the corrected words, but when I try to output to a .CSV file all the substitutions I have done are for nothing and I get garbage in my .CSV file. (The quotes work, guessing since it's such a general character).  Also Numéro will give NumÃ©ro.  The examples are endless.</p>
  
  <p>I wrote a small program to try and figure this issue out, but am not sure what the problem is.  I read on another stack overflow thread that you can import the .CSV in Excel and choose UTF8 encoding, this option does not pop up for me though.  I'm wondering if I can just encode it into whatever Excel's native character set is (UTF16BE???), or if there is another solution.  I have tried many variations on this short program, and let me say again that its just for testing out Unicode problems, not a part of a legit program.  Thanks.</p>
  
  <pre><code>use strict;
  use warnings;
  require Text::CSV_XS;
  use Encode qw/encode decode/;
  
  my $text = 'Numéro Numéro Numéro Orkos Capital SAS (√¢¬Ä¬úOrkos√¢¬Ä¬ù) 325M√¢¬Ç¬¨ in 40 companies headquartered';
  
  print("$text\n\n\n");
  
  $text =~ s/√¢¬Ä¬ú|√¢¬Ä¬ù/"/sig;
  $text =~ s/√¢¬Ä¬ôs/'s/sig;
  $text =~ s/√¢¬Ç¬¨/€/sig;
  $text =~ s/√¢¬Ñ¬¢/®/sig;
  $text =~ s/√Ç¬†/ /sig;
  
  print("$text\n\n\n");
  
  my $CSV = Text::CSV_XS-&gt;new ({ binary =&gt; 1, eol =&gt; "\n" }) or die "Cannot use CSV: ".Text::CSV-&gt;error_diag();
  
  open my $OUTPUT, "&gt;:encoding(utf8)", "unicode.csv" or die "unicode.csv: $!";
  
  my @row = ($text);
  
  $CSV-&gt;print($OUTPUT, \@row);
  $OUTPUT-&gt;autoflush(1);
  </code></pre>
  
  <p>I've also tried these two lines to no avail:</p>
  
  <pre><code>$text = decode("Guess", $text);
  $text = encode("UTF-16BE", $text);
  </code></pre>