Skip to content

Instantly share code, notes, and snippets.

@mccraigmccraig
Created October 21, 2010 15:24
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mccraigmccraig/638672 to your computer and use it in GitHub Desktop.
Save mccraigmccraig/638672 to your computer and use it in GitHub Desktop.
mail fails to decode encoded addresses
>> puts m.to_s
Date: Thu, 21 Oct 2010 16:28:20 +0100
From: craig mcmillan <victorianexercises@gmail.com>
To: =?UTF-8?B?ImNyYWlnIOaXpeacrOWbvSI=?= <craig@trampolinesystems.com>
Message-ID: <4CC05C14.6030501@mccraig.net>
Subject: =?UTF-8?Q?big_in_=E6=97=A5=E6=9C=AC=E5=9B=BD?=
Mime-Version: 1.0
Content-Type: text/plain;
charset=UTF-8;
format=flowed
Content-Transfer-Encoding: base64
User-Agent: Postbox 2.0.1 (Macintosh/20101011)
VW5pY29kZSBib2R5IGlzIGJpZyBpbiDml6XmnKzlm70=
=> nil
>> m.subject
=> "big in 日本国"
>> m.body.to_s
=> "Unicode body is big in 日本国"
>> m[:to].tree.addresses.first.name
=> "=?UTF-8?B?ImNyYWlnIOaXpeacrOWbvSI=?="
>> Mail::Encodings.decode_encode(m[:to].tree.addresses.first.name, :decode)
=> ""craig 日本国""
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment