craftsman icon indicating copy to clipboard operation
craftsman copied to clipboard

Case conversion of names is not culture-independent

Open scria1000 opened this issue 1 year ago • 1 comments

On machines where the current culture is set to Turkish, case conversion of identifiers result in the letter I being lowercased to the dotless-i (ı) variant instead of i.

I noticed that the code uses culture-specific ToLower(), ToUpper() instead of ToLowerInvariant(), ToUpperInvariant()

Generated docker-compose.yml causes issues with docker compose due to non-English letters not being allowed.

This does not appear to break the tool for now, and it can be remedied with a simple search and replace.

Generated docker-compose.yaml

Generated appsettings.json

Steps to reproduce

If you are on Windows, install the Language pack for Turkish and set just the Regional format to Turkish. Or you can just add these lines to the Program.cs of craftsman:

CultureInfo.DefaultThreadCurrentCulture = CultureInfo.GetCultureInfo("tr-TR");
CultureInfo.DefaultThreadCurrentUICulture = CultureInfo.GetCultureInfo("tr-TR");

Have a ProjectName/ContextName/DatabaseName and/or Entity/Property name that begins with the letter I such as Ingredients.

Further technical details

Craftsman version (dotnet tool list -g): 0.26.4

Similar issues in other projects

https://github.com/CommunityToolkit/dotnet/issues/230

scria1000 avatar Aug 23 '24 09:08 scria1000

Appreciate the callout on this! Will try and take a look at it soon

pdevito3 avatar Aug 23 '24 13:08 pdevito3

👋 the newest v0.27.0 release should resolve this, but I wasn't able to easily test this myself, so I'm going to keep this open for now. Let me know if you're still having issues and I can dig into it some more!

pdevito3 avatar Oct 06 '24 15:10 pdevito3