Issue #5277: Fix quote counting when parsing RFC 2231 encoded parameters.
diff --git a/Lib/email/message.py b/Lib/email/message.py
index 6adb3f6..993a1ac 100644
--- a/Lib/email/message.py
+++ b/Lib/email/message.py
@@ -62,7 +62,7 @@
     while s[:1] == ';':
         s = s[1:]
         end = s.find(';')
-        while end > 0 and s.count('"', 0, end) % 2:
+        while end > 0 and (s.count('"', 0, end) - s.count('\\"', 0, end)) % 2:
             end = s.find(';', end + 1)
         if end < 0:
             end = len(s)