title: Scandinavian characters get messed up when saved from DataGrid
body: <p>I'm working on a <code>xe:djxDataGrid</code> that loads and saves data via <code>xe:restService</code>. It loads the data from Domino documents and at this point all scandinavian characters like ä and ö look OK.</p>
  
  <p>But if data is modified and saved back to server ä turns to Ã¤ and ö turns to Ã¶. I think this is because data is UTF-8 encoded but gets interpreted as ISO-8559-1 at some point.</p>
  
  <p>I'm trying to use UTF-8 everywhere: </p>
  
  <ul>
  <li>Internet Site Document: Use UTF-8 for output - Yes</li>
  <li>Db Properties: Encoding - utf-8</li>
  <li>Form: Character set - Unicode (UTF-8)</li>
  </ul>
  
  <p>Response header of the page has this line: <code>Content-Type:text/html;charset=utf-8</code></p>
  
  <p>I've also tried changing the charset to ISO-8559-1 everywhere but that does not help. I've tried setting the <em>computeWithForm</em> property of REST control to true to see if that makes it use the form charset but it has no effect.</p>
  
  <p>In <strong>Firefox</strong> (17.0.1) everything works fine! The problem occurs at least in <strong>Chrome</strong> and <strong>IE9</strong>. </p>
  
  <p>Because it's browser specific I think it breaks when Dojo sends data to REST service. But I haven't seen a way to tell specifically to Dojo to use UTF-8.</p>
  
  <p>HTML tag looks like this:</p>
  
  <p>Chrome: <code>&lt;html lang="fi"&gt;</code>
  Firefox: <code>&lt;html class="dj_gecko dj_contentbox" lang="fi"&gt;</code></p>
  
  <p>djConfig is this: <code>djConfig="locale: 'fi-fi'</code>.</p>
  
  <p>Domino version is 8.5.3FP3 and ExtLib date is 20121217.</p>
  
  <p>Unfortunately I can't force the users to use Firefox only. Any ideas how to fix this?</p>
  
  <p><strong>edit 1</strong></p>
  
  <p>The same problem occurs in ExtLib demo application: xpagesext.nsf/REST_DojoGrid.xsp and xpagesext.nsf/REST_DojoGridJsonRest.xsp.</p>
  
  <p><strong>edit 2</strong></p>
  
  <p>As a workaround I can do this in field <em>Input Translations</em> on form:</p>
  
  <pre><code>@ReplaceSubstring(@ThisValue; "Ã¤":"Ã¶"; "ä":"ö");
  </code></pre>
  
  <p>This works when I enable <em>computeWithForm</em> in REST control. I need to include all non-english characters likely to be used. Or is there a generic way to convert all?</p>
  
  <p><strong>edit 3</strong></p>
  
  <p>As adviced by @Esailija I examined the HTTP PUT request which saves the data to server. This time I was testing with <strong>Opera</strong> 12.12 which also has the problem. The content type of the PUT request is:</p>
  
  <pre><code>Content-Type: application/json
  </code></pre>
  
  <p>With Firefox it is:</p>
  
  <pre><code>Content-Type:application/json; charset=UTF-8
  </code></pre>
  
  <p>This explains the problem but how to fix it? In my understanding the problem is with <em>dojox.grid.DataGrid</em> (1.6) control which does not set the charset in the PUT request. Firefox seems to set it automatically. Or is it actually in ExtLib DataGrid which fails to set the charset in the Dojo control? I haven't found a way to set charset in DataGrid.</p>
  
  <p><strong>edit 4</strong></p>
  
  <p>Tried changing <em>contentType</em> property in REST control from <code>application/json</code> to <code>application/json; charset=UTF-8</code>. That did not help and the content type of the PUT is still <code>application/json</code>.</p>
  
  <p>thanks,</p>
  
  <ul>
  <li>Panu</li>
  </ul>