title: japanese email subject encoding
body: <p>Aparently, encoding japanese emails is somewhat challenging, which I am slowly discovering myself. In case there are any experts (even those with limited experience will do), can I please have some guidelines as to how to do it, how to test it and how to verify it?</p>
  
  <p>Bear in mind that I've never set foot anywhere near Japan, it is simply that the product I'm developing is used there, among other places.</p>
  
  <p>What (I think) I know so far is following:<br>
  - Japanese emails should be encoded in ISO-2022-JP, Japanese JIS codepage 50220 or possibly SHIFT_JIS codepage 932<br>
  - Email transfer encoding should be set to Base64 for plain text and 7Bit for Html<br>
  - Email subject should be encoded separately to start with "=?ISO-2022-JP?B?" (don't know what this is supposed to mean). I've tried encoding the subject with  </p>
  
  <pre><code>"=?ISO-2022-JP?B?" + Convert.ToBase64String(Encoding.Unicode.GetBytes(subject))
  </code></pre>
  
  <p>which basically gives the encoded string as expected but it doesn't get presented as any japanese text in an email program<br>
  - I've tested in Outlook 2003, Outlook Express and GMail  </p>
  
  <p>Any help would be greatly appreciated</p>
  
  <hr>
  
  <p>Ok, so to post a short update, thanks to the two helpful answers, I've managed to get the right format and encoding. Now, Outlook gives something that resembles the correct subject:<br>
  <code>=?iso-2022-jp?B?6  Japanese test に各々の視点で語ってもらった。  6相当の防水?=</code></p>
  
  <p>However, the exact same email in Outlook Express gives subject like this:<br>
  <code>=?iso-2022-jp?B?6  Japanese test 縺ｫ蜷・・・隕也せ縺ｧ隱槭▲縺ｦ繧ゅｉ縺｣縺溘・ 6逶ｸ蠖薙・髦ｲ豌ｴ?=</code></p>
  
  <p>Furthermore, when viewed in the Inbox view in Outlook Express, the email subject is even more weird, like this:<br>
  <code>=?iso-2022-jp?B?6  Japanese test ??????????????? 6???????=</code></p>
  
  <p>Gmail seems to be working in the similar fashion to Outlook, which looks correct.</p>
  
  <p>I just can't get my head around this one.</p>