zod icon indicating copy to clipboard operation
zod copied to clipboard

.email() does not respect UTF8SMTP Extension standard (which includes öäü aka. Umlaute)

Open manuel-rw opened this issue 2 years ago • 7 comments

Hello, the RFC standard https://www.rfc-editor.org/rfc/rfc5336#section-3.2 allows users to use "öäü" and other special characters as part of their Email. Further information here: https://stackoverflow.com/questions/15121359/are-international-characters-e-g-umlaut-characters-valid-in-the-local-part-of

.email() currently does not respect this nor does it provide the option to allow this extension specifically.

Therefore, the following email will fail unexpectedly: schä[email protected]. The expected behavior would be, that validation would succeed.

Other examples for failing Emails include:

Via https://github.com/ajnart/homarr/issues/1747

manuel-rw avatar Dec 20 '23 10:12 manuel-rw

@JacobWeisenburger this is not an enhancement, but a bug IMO As it incorrectly fails valid emails

maybeanerd avatar Jul 11 '24 09:07 maybeanerd

Is anybody working on this right now? If not I might try picking it up this weekend

maybeanerd avatar Jul 11 '24 09:07 maybeanerd

I would assume no (no PR linked?). We are waiting for the upstream fix and sadly do not have capacity at the current time to fix this.

To elaborate: We're also not blocked by it, only one user opened issue for it

manuel-rw avatar Jul 11 '24 09:07 manuel-rw

I agree this is an enhancement due to this being about supporting an extension. The built-in validators are provided as best-efforts, but like in the case of numbers being valid emojis, your use case might not be covered by the existing check. Feel free to use string().regex() with your own email regex if you feel stuck, or submit a PR: I'd be happy to review something that passed the existing tests and adds support for this extension. We might want to make this a separate email type (.emailUtf8?) to support users who do not support the UTF8SMTP extension (which is an experimental standard as best I can tell that has been superceded by RFC 6531).

scotttrinh avatar Jul 11 '24 16:07 scotttrinh

What is the status of this?

jrscholey avatar Mar 31 '25 14:03 jrscholey

Sorry, life happened. I haven't started work on this , somebody else feel free to do so. If I get to it, I'll comment on this thread to let you know.

maybeanerd avatar Apr 06 '25 12:04 maybeanerd

this would be great!

simonmaass avatar Apr 06 '25 15:04 simonmaass

What is the status of this?

Out of scope: https://github.com/colinhacks/zod/pull/2157

gshpychka avatar Aug 04 '25 15:08 gshpychka