You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When using certain locales (e.g. jp_JP), the slug fake returns an empty string. I had a quick look and this is probably because the slugify decorator disallows unicode characters (which makes sense) and the fake is using the text fake under the hood - not anticipating that it is going to return unicode characters.
Steps to reproduce
fake = Faker("jp_JP")
fake.slug()
Expected behavior
The slug fake should never return an empty string
Actual behavior
The slug fake returns an empty string in some locales.
The text was updated successfully, but these errors were encountered:
I think the best effort behaviour here would be to return a slug with English characters, so it'd return an ascii slug even though it doesn't contain Japanese characters. This mimics the fallback behaviour of locale providers in general.
This fake is particularly problematic when in multi locale mode - where you only sometimes get an empty string because of certain locales. You may want to generate multi-locale text, but to still generate valid slugs without instantiating a separate generator only set to English for that purpose.
I think the best effort behaviour here would be to return a slug with English characters, so it'd return an ascii slug even though it doesn't contain Japanese characters. This mimics the fallback behaviour of locale providers in general.
This fake is particularly problematic when in multi locale mode - where you only sometimes get an empty string because of certain locales. You may want to generate multi-locale text, but to still generate valid slugs without instantiating a separate generator only set to English for that purpose.
This is a fair point, maybe make slug() always generate texts in locale en_US regardless of the assigned locale?
When using certain locales (e.g.
jp_JP
), theslug
fake returns an empty string. I had a quick look and this is probably because theslugify
decorator disallows unicode characters (which makes sense) and the fake is using thetext
fake under the hood - not anticipating that it is going to return unicode characters.Steps to reproduce
fake = Faker("jp_JP")
fake.slug()
Expected behavior
The
slug
fake should never return an empty stringActual behavior
The
slug
fake returns an empty string in some locales.The text was updated successfully, but these errors were encountered: