Skip to content
Projeler
Gruplar
Parçacıklar
Yardım
Yükleniyor...
Oturum aç / Kaydol
Gezinmeyi değiştir
C
cpython
Proje
Proje
Ayrıntılar
Etkinlik
Cycle Analytics
Depo (repository)
Depo (repository)
Dosyalar
Kayıtlar (commit)
Dallar (branch)
Etiketler
Katkıda bulunanlar
Grafik
Karşılaştır
Grafikler
Konular (issue)
0
Konular (issue)
0
Liste
Pano
Etiketler
Kilometre Taşları
Birleştirme (merge) Talepleri
0
Birleştirme (merge) Talepleri
0
CI / CD
CI / CD
İş akışları (pipeline)
İşler
Zamanlamalar
Grafikler
Paketler
Paketler
Wiki
Wiki
Parçacıklar
Parçacıklar
Üyeler
Üyeler
Collapse sidebar
Close sidebar
Etkinlik
Grafik
Grafikler
Yeni bir konu (issue) oluştur
İşler
Kayıtlar (commit)
Konu (issue) Panoları
Kenar çubuğunu aç
Batuhan Osman TASKAYA
cpython
Commits
12272a2f
Kaydet (Commit)
12272a2f
authored
Eki 01, 2002
tarafından
Barry Warsaw
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Docstring consistency with the updated .tex files.
üst
48330687
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
17 additions
and
17 deletions
+17
-17
Charset.py
Lib/email/Charset.py
+13
-13
Encoders.py
Lib/email/Encoders.py
+4
-4
No files found.
Lib/email/Charset.py
Dosyayı görüntüle @
12272a2f
...
...
@@ -85,7 +85,7 @@ CODEC_MAP = {
# Convenience functions for extending the above mappings
def
add_charset
(
charset
,
header_enc
=
None
,
body_enc
=
None
,
output_charset
=
None
):
"""Add char
set properties to the global map
.
"""Add char
acter set properties to the global registry
.
charset is the input character set, and must be the canonical name of a
character set.
...
...
@@ -104,7 +104,7 @@ def add_charset(charset, header_enc=None, body_enc=None, output_charset=None):
Both input_charset and output_charset must have Unicode codec entries in
the module's charset-to-codec mapping; use add_codec(charset, codecname)
to add codecs the module does not know about. See the codec module's
to add codecs the module does not know about. See the codec
s
module's
documentation for more information.
"""
if
body_enc
==
SHORTEST
:
...
...
@@ -126,7 +126,7 @@ def add_codec(charset, codecname):
charset is the canonical name of a character set. codecname is the name
of a Python codec, as appropriate for the second argument to the unicode()
built-in, or to the
.
encode() method of a Unicode string.
built-in, or to the encode() method of a Unicode string.
"""
CODEC_MAP
[
charset
]
=
codecname
...
...
@@ -138,8 +138,9 @@ class Charset:
This class provides information about the requirements imposed on email
for a specific character set. It also provides convenience routines for
converting between character sets, given the availability of the
applicable codecs. Given an character set, it will do its best to provide
information on how to use that character set in an email.
applicable codecs. Given a character set, it will do its best to provide
information on how to use that character set in an email in an
RFC-compliant way.
Certain character sets must be encoded with quoted-printable or base64
when used in email headers or bodies. Certain character sets must be
...
...
@@ -209,7 +210,7 @@ class Charset:
This is either the string `quoted-printable' or `base64' depending on
the encoding used, or it is a function in which case you should call
the function with a single argument, the Message object being
encoded. The function should then set the Content-Transfer-Encoding
:
encoded. The function should then set the Content-Transfer-Encoding
header itself to whatever is appropriate.
Returns "quoted-printable" if self.body_encoding is QP.
...
...
@@ -235,10 +236,10 @@ class Charset:
"""Convert a possibly multibyte string to a safely splittable format.
Uses the input_codec to try and convert the string to Unicode, so it
can be safely split on character boundaries (even for
double-
byte
can be safely split on character boundaries (even for
multi
byte
characters).
Returns the string
untouched if we don't know
how to convert it to
Returns the string
as-is if it isn't known
how to convert it to
Unicode with the input_charset.
Characters that could not be converted to Unicode will be replaced
...
...
@@ -256,10 +257,9 @@ class Charset:
def
from_splittable
(
self
,
ustr
,
to_output
=
True
):
"""Convert a splittable string back into an encoded string.
Uses the proper codec to try and convert the string from
Unicode back into an encoded format. Return the string as-is
if it is not Unicode, or if it could not be encoded from
Unicode.
Uses the proper codec to try and convert the string from Unicode back
into an encoded format. Return the string as-is if it is not Unicode,
or if it could not be converted from Unicode.
Characters that could not be converted from Unicode will be replaced
with an appropriate character (usually '?').
...
...
@@ -282,7 +282,7 @@ class Charset:
def
get_output_charset
(
self
):
"""Return the output character set.
This is self.output_charset if that is
set
, otherwise it is
This is self.output_charset if that is
not None
, otherwise it is
self.input_charset.
"""
return
self
.
output_charset
or
self
.
input_charset
...
...
Lib/email/Encoders.py
Dosyayı görüntüle @
12272a2f
...
...
@@ -51,7 +51,7 @@ def _bencode(s):
def
encode_base64
(
msg
):
"""Encode the message's payload in Base64.
Also, add an appropriate Content-Transfer-Encoding
:
header.
Also, add an appropriate Content-Transfer-Encoding header.
"""
orig
=
msg
.
get_payload
()
encdata
=
_bencode
(
orig
)
...
...
@@ -61,9 +61,9 @@ def encode_base64(msg):
def
encode_quopri
(
msg
):
"""Encode the message's payload in
Quoted-P
rintable.
"""Encode the message's payload in
quoted-p
rintable.
Also, add an appropriate Content-Transfer-Encoding
:
header.
Also, add an appropriate Content-Transfer-Encoding header.
"""
orig
=
msg
.
get_payload
()
encdata
=
_qencode
(
orig
)
...
...
@@ -73,7 +73,7 @@ def encode_quopri(msg):
def
encode_7or8bit
(
msg
):
"""Set the Content-Transfer-Encoding
:
header to 7bit or 8bit."""
"""Set the Content-Transfer-Encoding header to 7bit or 8bit."""
orig
=
msg
.
get_payload
()
if
orig
is
None
:
# There's no payload. For backwards compatibility we use 7bit
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment