title: Can't base64 decode utf-8 special characters properly
body: <p>I have an Android app that communicates with a Python backend. It sends a base64 encoded string and the Python server decodes it. It currently works fine for 0-9 A-z characters, but if I put in a æ, ø or other special characters, the entire output is garbled. Im assumning its an encoding issue, but I cant quite figure out what I'm doing wrong.</p>
  
  <p>Java:</p>
  
  <pre><code>public static String encodeToBase64(String text){
          byte[] data = null;
          try {
              data = text.getBytes("UTF-8");
          } catch (UnsupportedEncodingException e1) {
              e1.printStackTrace();
              return text;
          }
  
          text = Base64.encodeToString(data, Base64.DEFAULT);
          return text;
  
      }
  </code></pre>
  
  <p>And Python</p>
  
  <pre><code>subject = base64.b64decode(subject)
  body = base64.b64decode(body).decode('UTF-8')
  </code></pre>
  
  <p>Can anyone see what the issue is here?</p>
  
  <p>On the Java side, if I send in the following text, everything is fine</p>
  
  <pre><code>input = "[Mar 6 - 15:45:5] hello world"
  output = "W01hciA2IC0gMTU6NDU6NV0gaGVsbG8gd29ybGQKQmF0dGVyeTogNTAuMCU="
  </code></pre>
  
  <p>However, the following does not work.</p>
  
  <pre><code>input = "[Mar 6 - 15:46:54] hello wørld"
  </code></pre>
  
  <p>When Python decodes it it gets the following:</p>
  
  <pre><code>[Mar 6 - 15:46:54] ᘀ栀攀氀氀漀 眀爀氀
  </code></pre>
  
  <p>It gets encoded as </p>