Giter Club home page Giter Club logo

Comments (4)

martinvisser avatar martinvisser commented on May 28, 2024 1

Yeah, the RFC is super weird indeed. Thanks for the explanation though! I think the issue lies more at Valiktor's side then here, you have a good point there.
I'll close it with that reason.

from kotlin-faker.

serpro69 avatar serpro69 commented on May 28, 2024 1

No problem. Hope faker is still useful for you in it's current form :) And feel free to open another issue if you find something not working as expected or need help with something.

from kotlin-faker.

martinvisser avatar martinvisser commented on May 28, 2024

Also tried it with locale en-EN which gives emails like kieth.o'[email protected] and danelle.o'[email protected].

from kotlin-faker.

serpro69 avatar serpro69 commented on May 28, 2024

Hi @martinvisser , thanks for raising the issue.
If I understand correctly, the issue for you is either ' (or potentially other special chars) and/or accented letters? I'm not sure what rules the library you mention uses to validate emails, but IIRC what is allowed in the RFC-2822 for the local part (before the @some.domain) of the email address, then all of the email addresses you've posted here are valid.
Then again, email validation should be a very domain-specific thing, and from my experience, I don't think you generally want to conform to the RFC standards for email addresses, because frankly they allow very weird stuff.
Having your application targeted to users who live in Netherlands, for example, you might want to allow people to use accented characters in their names, such as jurriën, or you might not want to do that. That's up to you as an app developer, but RFC allows these chars, for example.

Now to what's actually causing this. The problem here is that an email is generated from a person's name (if you don't hardcode the name yourself of course):


And since those names might contain special chars, for example see the first/last names in the nl locale dictionary file:

Then I don't see how to effectively solve this even if it made sense to do so, since it would need to be accounted for all supported locales, each possibly having its own "special letters".

So if you don't want special chars like ' or accented letters like ë in your accepted email addresses, my suggestion would be to create a wrapper function that would replace them after the email has been generated, e.g.

fun normalizedEmail(): String {
    return faker.internet.email().replace("ë", "e")
}

A very crude example which can easily be expanded to cover all your specific cases.

from kotlin-faker.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.