Skip to content

random.word() can return undesirable non-alpha characters #113

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
griest024 opened this issue Jan 12, 2022 · 4 comments · Fixed by #654
Closed

random.word() can return undesirable non-alpha characters #113

griest024 opened this issue Jan 12, 2022 · 4 comments · Fixed by #654
Assignees
Labels
c: bug Something isn't working p: 1-normal Nothing urgent s: accepted Accepted feature / Confirmed bug

Comments

@griest024
Copy link
Contributor

griest024 commented Jan 12, 2022

Describe the bug

The pool of strings from which random.words() pulls values includes strings that have parentheses, e.g. Cocos (Keeling) Islands and Killer Whale (Orca). This can result in (Keeling) and (Orca) being returned.

There's a larger problem here of non-alphabetic characters being returned in words. Obviously some non-alpha characters are desired in words, e.g. -, but some are not. We should decide on the set of acceptable characters that word() can return and regex the others out.

Reproduction

Mock faker.fake with the above mentioned values and you can see the bad returns.

Additional Info

@griest024 griest024 added c: bug Something isn't working s: pending triage Pending Triage labels Jan 12, 2022
@github-actions github-actions bot removed the s: pending triage Pending Triage label Jan 12, 2022
prisis added a commit to PrisisForks/faker that referenced this issue Jan 12, 2022
prisis added a commit to PrisisForks/faker that referenced this issue Jan 18, 2022
prisis added a commit to PrisisForks/faker that referenced this issue Jan 18, 2022
prisis added a commit to PrisisForks/faker that referenced this issue Jan 19, 2022
@pkuczynski
Copy link
Member

I can work on this. Let me know if you want me to...

@griest024
Copy link
Contributor Author

I can work on this. Let me know if you want me to...

Sure I can assign you. What do you think should be the allowed chars? How would you handle other locales?

@pkuczynski
Copy link
Member

pkuczynski commented Jan 23, 2022

I took a bit different approach. Have a look at #276

@Shinigami92
Copy link
Member

I will try to create a PR soon that just uses a /\w+/ regex

@Shinigami92 Shinigami92 self-assigned this Mar 22, 2022
@Shinigami92 Shinigami92 moved this from In Progress to Awaiting Review in Faker Roadmap Mar 22, 2022
@Shinigami92 Shinigami92 added p: 1-normal Nothing urgent s: accepted Accepted feature / Confirmed bug labels Mar 22, 2022
Repository owner moved this from Awaiting Review to Done in Faker Roadmap Mar 24, 2022
@ST-DDT ST-DDT removed this from Faker Roadmap Nov 4, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment