Commit fe5e21f
committed
Enforce ASCII-only constraint per RFC 5322 specification
RFC 5322 (Internet Message Format) is strictly an ASCII-only specification.
This change ensures compliance by validating that email addresses contain only
ASCII characters.
Changes:
- Add ValidationError.nonASCIICharacters case with error description
- Validate ASCII-only in LocalPart.init using String.asciiBytes from INCITS_4_1986
- Replace manual character classification with INCITS_4_1986 utilities
(isASCIILetter, isASCIIDigit, isASCIIWhitespace) in String.swift and [UInt8].swift
- Add import INCITS_4_1986 to String.swift
This prevents non-ASCII characters from being accepted in RFC 5322 contexts,
ensuring compliance with the specification and preventing potential issues with
email systems that expect ASCII-only message format.1 parent ae7db4f commit fe5e21f
File tree
3 files changed
+30
-3
lines changed- Sources/RFC_5322
3 files changed
+30
-3
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
110 | 110 | | |
111 | 111 | | |
112 | 112 | | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
113 | 118 | | |
114 | 119 | | |
115 | 120 | | |
| |||
177 | 182 | | |
178 | 183 | | |
179 | 184 | | |
180 | | - | |
| 185 | + | |
181 | 186 | | |
182 | 187 | | |
183 | 188 | | |
| |||
191 | 196 | | |
192 | 197 | | |
193 | 198 | | |
| 199 | + | |
| 200 | + | |
| 201 | + | |
| 202 | + | |
| 203 | + | |
| 204 | + | |
| 205 | + | |
| 206 | + | |
| 207 | + | |
| 208 | + | |
| 209 | + | |
| 210 | + | |
| 211 | + | |
| 212 | + | |
| 213 | + | |
| 214 | + | |
| 215 | + | |
| 216 | + | |
| 217 | + | |
| 218 | + | |
194 | 219 | | |
195 | 220 | | |
196 | 221 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
5 | 5 | | |
6 | 6 | | |
7 | 7 | | |
| 8 | + | |
| 9 | + | |
8 | 10 | | |
9 | 11 | | |
10 | 12 | | |
| |||
28 | 30 | | |
29 | 31 | | |
30 | 32 | | |
31 | | - | |
| 33 | + | |
32 | 34 | | |
33 | 35 | | |
34 | 36 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
35 | 35 | | |
36 | 36 | | |
37 | 37 | | |
38 | | - | |
| 38 | + | |
39 | 39 | | |
40 | 40 | | |
41 | 41 | | |
| |||
0 commit comments