blakeembrey / change-case

Convert strings between camelCase, PascalCase, Capital Case, snake_case and more
MIT License
2.21k stars 92 forks source link

Turkish character problem #297

Closed Byblack36 closed 9 months ago

Byblack36 commented 1 year ago

The letter "I" solve the problem I am having how big the Turkish character problem I return the letter "I" is small "l" when it turns

blakeembrey commented 1 year ago

Can you share what the expected character is? Those are all just ascii characters using either I or L and I'm unclear what you're expecting. Which package are you having problems with?

blakeembrey commented 1 year ago

As an example, 'I'.toLocaleLowerCase('tr') returns ı. I assume that's correct?

Byblack36 commented 1 year ago

Example = IĞDIR Output= iğdir Should Be= ığdır

blakeembrey commented 1 year ago

What package are you using?

blakeembrey commented 1 year ago

I think the issue is that I haven’t exposed the locale setting outside the lower/upper case packages. I can look into doing that in the next major release.

Byblack36 commented 1 year ago

image

Byblack36 commented 1 year ago

I think the problem is the locale setting small/big letters on the outside of the package that I didn't show it. I can think of to do this in the next major release.

would be great if you update

blakeembrey commented 1 year ago

Currently there’s no internationalization support in the library but I will update it when I have time. Which method of the library are you using?

Byblack36 commented 1 year ago

I don't quite understand what you said, are you asking for what purpose I used it?

furedal commented 11 months ago

Hi, i've found this to be an issue as well as I use this library for snakecasing, camelcasing api responses.

What happens when the client has Turkish set as their locality on the browser, this library will change keys to unexpected results example: {this_is_a_key: foo} => {THİS_İS_A_KEY: foo} You will get a turkish İ instead of I which results in errors when you expect being able to access the variable like this: result.THIS_IS_A_KEY

The problem is that this library uses toLowerCase and toUpperCase instead of toLocaleLowerCase and toLocaleUpperCase.

To get away from breaking any backwards compatibility, my suggestion is to give this library the option too choose which locality the library transforms to as a parameter for the transform-functions.

toLocaleLowerCase

blakeembrey commented 9 months ago

This has been fixed with change-case@5.0.0. Please update and let me know if you still see any issues.