def test_zcp_13036_0d(session, store, message): rfc = open(MAILS_PATH.format('zcp-13036-0db504a2.eml'), 'rb').read() dopt = inetmapi.delivery_options() inetmapi.IMToMAPI(session, store, None, message, rfc, dopt) props = message.GetProps([PR_INTERNET_CPID, PR_BODY_W], 0) assert GetCharsetByCP(props[0].Value) == "utf-8" assert "zgłoszeń" in props[1].Value
def test_zcp_13036_69(session, store, message): rfc = open(MAILS_PATH.format('zcp-13036-6906a338.eml'), 'rb').read() dopt = inetmapi.delivery_options() inetmapi.IMToMAPI(session, store, None, message, rfc, dopt) props = message.GetProps([PR_INTERNET_CPID, PR_BODY_W], 0) assert GetCharsetByCP(props[0].Value) == "iso-8859-1" assert "Jänner" in props[1].Value
def test_mime_charset_01(session, store, message, dopt, eml): rfc = open(MAILS_PATH.format(eml), 'rb').read() inetmapi.IMToMAPI(session, store, None, message, rfc, dopt) props = message.GetProps([PR_INTERNET_CPID, PR_BODY_W], 0) charset = GetCharsetByCP(props[0].Value) assert charset == "utf-8" assert props[1].Value == "tæst"
def test_mime_charset_03(session, store, message, dopt): rfc = open(MAILS_PATH.format('mime_charset_03.eml'), 'rb').read() dopt.ascii_upgrade = None inetmapi.IMToMAPI(session, store, None, message, rfc, dopt) props = message.GetProps([PR_INTERNET_CPID], 0) charset = GetCharsetByCP(props[0].Value) assert charset == "us-ascii"
def test_html_charset_02(session, store, message, dopt): rfc = open(MAILS_PATH.format('html-charset-02.eml'), 'rb').read() dopt.charset_strict_rfc = False inetmapi.IMToMAPI(session, store, None, message, rfc, dopt) props = message.GetProps([PR_INTERNET_CPID], 0) charset = GetCharsetByCP(props[0].Value) assert charset == "iso-8859-1"
def test_zcp_13175(session, store, message, dopt): rfc = open(MAILS_PATH.format('zcp-13175.eml'), 'rb').read() inetmapi.IMToMAPI(session, store, None, message, rfc, dopt) props = message.GetProps([PR_INTERNET_CPID, PR_BODY_W], 0) assert GetCharsetByCP(props[0].Value) == "utf-8" print(props[1].Value) assert "extrem überhöht" in props[1].Value
def test_zcp_13449_meca(session, store, message, dopt): rfc = open(MAILS_PATH.format('zcp-13449-meca.eml'), 'rb').read() dopt.charset_strict_rfc = False inetmapi.IMToMAPI(session, store, None, message, rfc, dopt) props = message.GetProps([PR_INTERNET_CPID, PR_BODY_W], 0) assert GetCharsetByCP(props[0].Value) == "windows-1252" assert "Mécanique" in props[1].Value
def test_zcp_13439_nl(session, store, message, dopt): rfc = open(MAILS_PATH.format('zcp-13439-nl.eml'), 'rb').read() inetmapi.IMToMAPI(session, store, None, message, rfc, dopt) props = message.GetProps([PR_INTERNET_CPID, PR_BODY_W, PR_SUBJECT_W], 0) assert GetCharsetByCP(props[0].Value) == "utf-8" assert "für" in props[1].Value assert "Ää Öö Üü ß – Umlautetest, UMLAUTETEST 2" == props[2].Value
def test_zcp_13337(session, store, message, dopt): rfc = open(MAILS_PATH.format('zcp-13337.eml'), 'rb').read() inetmapi.IMToMAPI(session, store, None, message, rfc, dopt) props = message.GetProps([PR_INTERNET_CPID, PR_BODY_W], 0) assert GetCharsetByCP(props[0].Value) == "utf-8" # non breaking space assert "\xa0" in props[1].Value
def test_iconvonly(session, store, message, dopt, eml): # iconvonly01 has a charset for which no Win32 CPID exists (at # least in our codepage.cpp), and so gets reconverted by inetmapi # to UTF-8 so Windows has something to display. rfc = open(MAILS_PATH.format(eml), 'rb').read() inetmapi.IMToMAPI(session, store, None, message, rfc, dopt) props = message.GetProps([PR_INTERNET_CPID], 0) charset = GetCharsetByCP(props[0].Value) assert charset == "utf-8"
def test_zcp_12930(session, store, message, dopt): rfc = open(MAILS_PATH.format('zcp-12930.eml'), 'rb').read() dopt.ascii_upgrade = None inetmapi.IMToMAPI(session, store, None, message, rfc, dopt) props = message.GetProps([PR_INTERNET_CPID, PR_BODY_W], 0) charset = GetCharsetByCP(props[0].Value) assert charset == "us-ascii" assert "simply dummy t ext" in props[1].Value
def test_zcp_11713(session, store, message, dopt): rfc = open(MAILS_PATH.format('zcp-11713.eml'), 'rb').read() dopt.charset_strict_rfc = False inetmapi.IMToMAPI(session, store, None, message, rfc, dopt) props = message.GetProps([PR_INTERNET_CPID, PR_BODY_W], 0) # ISO-2022-JP (50220, 50222) is a valid outcome of any decoder. # SHIFT_JIS (932) is a possible outcome of ZCP's IMToMAPI, but not # strictly RFC-conformant. charset = GetCharsetByCP(props[0].Value) assert charset == "shift-jis" assert "メッセージ" in props[1].Value
def test_zcp_13449_na(session, store, message, dopt): # On unknown Content-Transfer-Encodings, the MIME part needs to be # read raw and tagged application/octet-stream (RFC 2045 §6.4 pg 17). rfc = open(MAILS_PATH.format('zcp-13449-na.eml'), 'rb').read() dopt.ascii_upgrade = None inetmapi.IMToMAPI(session, store, None, message, rfc, dopt) props = message.GetProps([PR_INTERNET_CPID, PR_BODY_W, PR_SUBJECT_W], 0) assert GetCharsetByCP(props[0].Value) == "us-ascii" # All non-ASCII is stripped, and the '!' is the leftover. assert "!" in props[1].Value # May need rework depending on how unreadable characters # are transformed (decoder dependent). assert "N??t ASCII??????" == props[2].Value
def test_zcp_13473(session, store, message, dopt): rfc = open(MAILS_PATH.format('zcp-13473.eml'), 'rb').read() inetmapi.IMToMAPI(session, store, None, message, rfc, dopt) props = message.GetProps([PR_INTERNET_CPID], 0) assert GetCharsetByCP(props[0].Value) == "utf-8"