Skip to content

Instantly share code, notes, and snippets.

@cb372
Last active December 28, 2015 23:09
Show Gist options
  • Save cb372/7576659 to your computer and use it in GitHub Desktop.
Save cb372/7576659 to your computer and use it in GitHub Desktop.
Generating a B-encoded mail subject
val encoding = "iso-2022-jp"
val subject = "こんにちは、世界"
val base64 = javax.xml.bind.DatatypeConverter.printBase64Binary(subject.getBytes(encoding))
val bEncoded = s"=?$encoding?B?$base64?="
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment