如何翻译邮件主题(Subject)中的字符乱码(主要是中文)?(200分)

  • 主题发起人 主题发起人 leonye
  • 开始时间 开始时间
FoxMail据说是用Delphi3写的
这里很活跃
 
我试的几种Foxmail都能识别!

没有资料也有办法,关键看你有没有耐心! *_^
枚举法:
找几个连续的单个汉字作邮件主题,自己给自己发几个,再把收到的邮件主题(乱码)整理一下,找出规律应该可以! :)
 
原来是这样,不过关键还是知道各种编码的格式,
然后自己就可以解了。估计那些:
?gb2312?B?u9i4tDoguPbIy9b30rPJ6sfro6E=?=
是uuencode的编码?
 
Hehe, I found RFC1522.txt: 我已经寄出给leonye, 不好意思, 为了抢到一点分, :)
如果其他网友想要, 尽管和我联系
这里把主要的精髓摘录如下:
MIME extersion part 2:
Message Header Extensions for Non-ASCII Text

Here is a brief explanation:

编码规则:
encoded-word = "=?" charset "?" encoding "?" encoded-text "?="
charset = token ; see section 3

encoding = token ; see section 4

token = 1*<Any CHAR except SPACE, CTLs, and especials>

especials = "(" / ")" / "&lt" / "&gt" / "@" / "," / ";" / ":" / "
&lt"&gt / "/" / "[" / "]" / "?" / "." / "="

encoded-text = 1*&ltAny printable ASCII character other
than "?" or SPACE&gt
; (but see "Use of encoded-words in message
; headers", section 5)

Both "encoding" and "charset" names are case-independent. Thus the
charset name "ISO-8859-1" is equivalent to "iso-8859-1", and the
encoding named "Q" may be spelled either "Q" or "q".

4. Encodings

Initially, the legal values for "encoding" are "Q" and "B". These
encodings are described below. The "Q" encoding is recommended for
use when most of the characters to be encoded are in the ASCII
character set; otherwise, the "B" encoding should be used.
Nevertheless, a mail reader which claims to recognize encoded-words
MUST be able to accept either encoding for any character set which it
supports.

4.1. The "B" encoding

The "B" encoding is identical to the "BASE64" encoding defined by RFC
1521.

4.2. The "Q" encoding

The "Q" encoding is similar to the "Quoted-Printable" content-
transfer-encoding defined in RFC 1521. It is designed to allow text
containing mostly ASCII characters to be decipherable on an ASCII
terminal without decoding.
(1) Any 8-bit value may be represented by a "=" followed by two
hexadecimal digits. For example, if the character set in use
were ISO-8859-1, the "=" character would thus be encoded as
"=3D", and a SPACE by "=20". (Upper case should be used for
hexadecimal digits "A" through "F".)

(2) The 8-bit hexadecimal value 20 (e.g., ISO-8859-1 SPACE) may be
represented as "_" (underscore, ASCII 95.). (This character may
not pass through some internetwork mail gateways, but its use
will greatly enhance readability of "Q" encoded data with mail
readers that do not support this encoding.) Note that the "_"
always represents hexadecimal 20, even if the SPACE character
occupies a different code position in the character set in use.

(3) 8-bit values which correspond to printable ASCII characters other
than "=", "?", "_" (underscore), and SPACE may be represented as
those characters. (But see section 5 for restrictions.)
 
接受答案了.
 

Similar threads

后退
顶部