Comments (4)
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.
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.
Also tried it with locale en-EN
which gives emails like kieth.o'[email protected]
and danelle.o'[email protected]
.
from kotlin-faker.
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)
- Make it possible to lookup providers by name in cli
- Improve integration tests
- Allow RandomClassProvider::randomClassInstance to use predefinedGenerators from config if present HOT 4
- RandomClassProvider doesn't handle constructorless types correctly in all instances HOT 1
- Allow random to be used with unique HOT 1
- Regexify generates invalid value HOT 2
- Regexify should take Regex as an argument HOT 1
- Regexify fails with StackOverflowError HOT 5
- random.nextLong(bound: Long) also returns negative values HOT 3
- Suggestion: internet.ipv4() and internet.ipv6() HOT 4
- Support inner classes in RandomClassProvider
- Remove all deprecated functionality in faker 2.0
- Split core Faker into sub-fakers by categories
- Allow creating custom fakers / generators
- kotlin-faker 2.0 - Breaking Changes HOT 1
- Suggestion: Add a Database Provider HOT 6
- Add Kotlin BCV to keep changes to public API under control
- Add BOM to manage dependencies HOT 2
- Figure out versioning for submodules
- Kotlin Multiplatform Support HOT 11
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from kotlin-faker.