Repository navigation
Commit 5509dd4
committed
gh-162080: Fix UnicodeEncodeError for non-ASCII MIME-Version header
A MIME-Version header containing undecodable (non-ASCII) bytes parsed without error but could not be serialized again: as_bytes() and as_string() raised UnicodeEncodeError. parse_mime_version() now runs _validate_xtext() on the invalid-text terminals it creates, so an UndecodableBytesDefect is registered and the header is refolded using the unknown-8bit charset, as for other structured headers.
Signed-off-by: Gaurav Kumar Yadav <xgauravyaduvanshii@gmail.com>1 parent 9427640 commit 5509dd4
3 files changed
Lines changed: 60 additions & 4 deletions
File tree
- Lib
- email
- test/test_email
- Misc/NEWS.d/next/Library
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2253 | 2253 | | |
2254 | 2254 | | |
2255 | 2255 | | |
2256 | | - | |
| 2256 | + | |
| 2257 | + | |
| 2258 | + | |
2257 | 2259 | | |
2258 | 2260 | | |
2259 | 2261 | | |
| |||
2265 | 2267 | | |
2266 | 2268 | | |
2267 | 2269 | | |
2268 | | - | |
| 2270 | + | |
| 2271 | + | |
| 2272 | + | |
2269 | 2273 | | |
2270 | 2274 | | |
2271 | 2275 | | |
| |||
2284 | 2288 | | |
2285 | 2289 | | |
2286 | 2290 | | |
2287 | | - | |
| 2291 | + | |
| 2292 | + | |
| 2293 | + | |
2288 | 2294 | | |
2289 | 2295 | | |
2290 | 2296 | | |
| |||
2294 | 2300 | | |
2295 | 2301 | | |
2296 | 2302 | | |
2297 | | - | |
| 2303 | + | |
| 2304 | + | |
| 2305 | + | |
2298 | 2306 | | |
2299 | 2307 | | |
2300 | 2308 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
966 | 966 | | |
967 | 967 | | |
968 | 968 | | |
| 969 | + | |
| 970 | + | |
| 971 | + | |
| 972 | + | |
| 973 | + | |
| 974 | + | |
| 975 | + | |
| 976 | + | |
| 977 | + | |
| 978 | + | |
| 979 | + | |
| 980 | + | |
| 981 | + | |
| 982 | + | |
| 983 | + | |
| 984 | + | |
| 985 | + | |
| 986 | + | |
| 987 | + | |
| 988 | + | |
| 989 | + | |
| 990 | + | |
| 991 | + | |
| 992 | + | |
| 993 | + | |
| 994 | + | |
| 995 | + | |
| 996 | + | |
| 997 | + | |
| 998 | + | |
| 999 | + | |
| 1000 | + | |
| 1001 | + | |
| 1002 | + | |
| 1003 | + | |
| 1004 | + | |
| 1005 | + | |
| 1006 | + | |
| 1007 | + | |
| 1008 | + | |
| 1009 | + | |
| 1010 | + | |
| 1011 | + | |
969 | 1012 | | |
970 | 1013 | | |
971 | 1014 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
0 commit comments