简体   繁体   English

越南电子邮件主题编码?

[英]vietnamese email subject encoding?

Subject: Re:
 =?UTF-8?Q?Th=E1=BA=A7y_g=E1=BB=ADi_b=C3=A0i_t=E1=BA=ADp_cho_em_v=E1=BB?=
 =?UTF-8?Q?=9Bi.?=

I received an email with this subject header. 我收到了带有此主题标题的电子邮件。 How should it be decoded? 应该如何解码?

It's a MIME encoded-word . 这是一个MIME编码字 The syntax is =? 语法是=? charset ? 字符集? transfer-encoding ? 传输编码? encoded-data ?= . 编码数据?= Transfer encoding is B ase64 or Q uoted-printable. 传输编码是B ase64或Q uoted可印刷。

To decode it: 解码:

  1. Split the encoded word into its 3 parts. 将编码的单词分成3部分。
  2. Decode the data (3rd part) into byte[] according to its transfer encoding (2nd part). 根据数据的传输编码(第二部分)将数据(第三部分)解码为byte[] In this case, the Q encoding is used, so replace the = xx sequences with the corresponding octets. 在这种情况下,将使用Q编码,因此将= xx序列替换为相应的八位位组。 This gives you the two byte arrays [84, 104, 225, 186, 167, 121, 95, 103, 225, 187, 173, 105, 95, 98, 195, 160, 105, 95, 116, 225, 186, 173, 112, 95, 99, 104, 111, 95, 101, 109, 95, 118, 225, 187] and [155, 105, 46]. 这将为您提供两个字节数组[84、104、225、186、167、121、95、103、225、187、173、105、95、98、195、160、105、95、116、225、186, 173、112、95、99、104、111、95、101、109、95、118、225、187]和[155、105、46]。
  3. Decode these byte arrays according to the specified encoding. 根据指定的编码对这些字节数组进行解码。

In this particular example, both of the encoded-words are invalid : The first one is missing a trail byte of a 3-byte UTF-8 character, and the second one starts with a trail byte. 在此特定示例中,两个编码字均无效 :第一个缺少3字节UTF-8字符的尾随字节,第二个以尾随字节开头。 But combined , they're valid UTF-8, and decode to the string Thầy_gửi_bài_tập_cho_em_với. 但是结合起来 ,它们是有效的UTF-8,并解码为字符串Thầy_gửi_bài_tập_cho_em_với. (which Google Translates to "Teacher sent me to exercise.") (Google翻译为“老师让我锻炼身体”。)

This is defined in RFC 2047: http://tools.ietf.org/html/rfc2047 这是在RFC 2047中定义的: http : //tools.ietf.org/html/rfc2047

See section 4 on encodings. 有关编码,请参见第4节。 I'm not sure if there's anything in the base framework that handles this/handles this correctly. 我不确定基本框架中是否有任何东西可以正确处理/处理这个问题。

Edit: here's one person's attempt at this: http://vsevolodp.blogspot.com/2010/11/how-to-decode-encoded-word-header.html 编辑:这是一个人的尝试: http : //vsevolodp.blogspot.com/2010/11/how-to-decode-encoded-word-header.html

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM