title: Wrapping Hashmap with method malformed encoding
body: <p>I have a hashmap that contains labels for different languages. Previously I used this to populate my translated objects with the translation directly from the map that worked fine. </p>
  
  <pre><code>     Map&lt;String, String&gt; m = new HashMap&lt;&gt;();
          m.put("sv", "Läs mer");
  //...
  t.setLabel(m.getOrDefault(language, ""))
  </code></pre>
  
  <p>Now sometimes, my key can also contain the country, "sv_SE", so I wrote a wrapper method for this:</p>
  
  <pre><code>private static String getLabel(String key) {
      String value = m.get(key);
      if (value == null) {
          int i = key.indexOf("_");
          if (i &gt; 0) {
              value = m.getOrDefault(key.substring(0, i), "");
          } else {
              value = "";
          }
      }
      if (!key.equals("en") &amp;&amp; value.equals("")) {
          System.out.println("WARN: Used \"\" label for " + key );
      }
      return value;
  }
  </code></pre>
  
  <p>However, when I started using this wrapper, non english characters gets malformed in the .json file I write this content to later:</p>
  
  <pre><code>"L��s mer"
  </code></pre>
  
  <p>What is going on here? The only thing I did was adding this wrapper method. </p>