summaryrefslogtreecommitdiffstats
path: root/Lib/email/utils.py
diff options
context:
space:
mode:
Diffstat (limited to 'Lib/email/utils.py')
-rw-r--r--Lib/email/utils.py4
1 files changed, 4 insertions, 0 deletions
diff --git a/Lib/email/utils.py b/Lib/email/utils.py
index 138f05d..b82d5c5 100644
--- a/Lib/email/utils.py
+++ b/Lib/email/utils.py
@@ -57,6 +57,10 @@ TICK = "'"
specialsre = re.compile(r'[][\\()<>@,:;".]')
escapesre = re.compile(r'[\\"]')
+# How to figure out if we are processing strings that come from a byte
+# source with undecodable characters.
+_has_surrogates = re.compile(
+ '([^\ud800-\udbff]|\A)[\udc00-\udfff]([^\udc00-\udfff]|\Z)').search
# Helpers