title: Writing Unicode characters from Java using Apache POI XSSF to an Excel file ".xlsx"
body: <p>I am working on a project that is currently using <a href="http://en.wikipedia.org/wiki/Apache_POI" rel="nofollow">POI</a> to write out to an Excel file using the XSSF Workbook. I have an issue with writing out <a href="http://en.wikipedia.org/wiki/Unicode" rel="nofollow">Unicode</a> characters to the Excel document and having them displaying correctly.</p>
  
  <p>I am using Pattern and Matcher to find and replace other tags in text with the corresponding Unicode characters.</p>
  
  <pre><code>private static String replaceTags(String stringToChange, String replacementTag, String originalTag) {
      Pattern pattern = Pattern.compile(originalTag);
      Matcher matcher = pattern.matcher(stringToChange);
      return matcher.replaceAll(replacementTag);
  }
  </code></pre>
  
  <p>I call that function in my code to find and replace tags in my text. It's working for most of my replacement tags, but not for things like the Trademark symbol and the quotation mark, because I can't use the actual symbol for them as replacements, I have to put the Unicode for them.</p>
  
  <pre><code>if (replacementString.contains("%0022")) {
      replacementString = replaceTags(replacementString, "\\U005C", "%0022");
  }
  c.setCellValue(replacementString);
  </code></pre>
  
  <p>Now the problem I'm running into is when I write the string to the Excel file Excel ignores the backslash in front of the <code>U005C</code> and just writes the code out like normal text. Is there a way to get these characters to appear from the code that I'm missing or is it even possible to do?</p>
  
  <p><strong>Update:</strong></p>
  
  <p>I have gotten every symbol I need to work except for the quotation mark. Using <code>\\\\U005c</code> or <code>\\\\U0022</code> has the Excel spreadsheet displaying \U005c or \U0022 instead of <code>"</code>.</p>