title: Solr JavaScript transformers and special characters (æ, ø, and å)
body: <p>I am running <a href="http://en.wikipedia.org/wiki/Apache_Solr" rel="nofollow noreferrer">Solr</a> 1.4 with the <a href="http://en.wikipedia.org/wiki/Jetty_%28web_server%29" rel="nofollow noreferrer">Jetty</a> web server. I have a transformer, written in JavaScript in my <code>data-config.xml</code> file, that looks as follows:</p>
  
  <pre><code>    &lt;script&gt;&lt;![CDATA[
          function transform(row) {
  
              var itemColor = row.get('ItemColor');
  
              if (itemColor == 'SORT' || itemColor == 'BLACK') {
                  row.put('ItemColor', 'Sort');
              }
  
              else if (itemColor == 'RØD' || itemColor == 'RED') {
                  row.put('ItemColor', 'Rød');
          }
  
          return row;
      }
      ]]&gt;&lt;/script&gt;
  </code></pre>
  
  <p>Basically, what I am trying to do is to replace 'RØD' and 'RED' with 'Rød', and 'SORT' and 'BLACK' with 'Sort' before I add <code>itemColor</code> to the Solr index. ('SORT' is black and 'RØD' is red in Danish).</p>
  
  <p>But for some reason the else-if part is never true, although <code>itemColor</code> has the value 'RØD'. There are no problems updating <code>itemColor</code> when the value is 'SORT' or 'BLACK'. I suspect it has something to do with special characters (Æ, Ø, and Å). I have tried with colors that contains those characters and it fails every time.</p>
  
  <p>What is the solution?</p>