Skip to content
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

i - I case conversion problem in Turkish locale #953

Closed
rmatesz opened this issue Sep 30, 2015 · 8 comments
Closed

i - I case conversion problem in Turkish locale #953

rmatesz opened this issue Sep 30, 2015 · 8 comments
Milestone

Comments

@rmatesz
Copy link

rmatesz commented Sep 30, 2015

In Turkish language there are two kind of i letter and therefore there is a common issue when trying to convert to lower or upper case (check: http://lotusnotus.com/lotusnotus_en.nsf/dx/dotless-i-tolowercase-and-touppercase-functions-use-responsibly.htm).
When a JSON string which contains field starting with upper case i (e.g. Icon) is being tried to deserialize with caseInsensitive = true property, the mapper is unable to find and fill the "icon" field in the object model because of the convertion issue described above.
Technical info: I've checked the source code of the library and there are some places where toLowerCase and/or toUpperCase is called with default Locale. These calls should be done with English locale when the calls are key-related to avoid this kind of issues.

Here is the specific place for the actual issue: https://github.com/FasterXML/jackson-databind/blob/master/src/main/java/com/fasterxml/jackson/databind/deser/impl/BeanPropertyMap.java#L314

Workaround: JsonProperty annotation have to be set for these fields to exactly set the name case-sensitively.

@cowtowncoder
Copy link
Member

Thank you for reporting this. There are indeed a few places where leading character(s) are being lower cased, in addition to the code that tries full lower-casing you mention. I'll see if I can figure out a way to tease the problem, although I assume it would require use of the specific letter(s) to have effect, as well as override of the default locale.

I wonder, however, if the turkish handling would be desired in some cases? Since context objects (SerializerProvider, DeserializationContext) have configured Locale (accessible via getLocale()), perhaps it would make sense to use that instead of the default system Locale?
Then again, as things are this will be taken from Locale.getDefault(). But at least it would then be possible to force it to something else. It would also be possible to change the default Locale for Jackson for 2.7.

@cbsmith
Copy link

cbsmith commented Dec 4, 2015

I love it. The first bug I've seen in a while that successfully calls out the famous "Turkish I Problem": http://www.salon.com/2004/12/09/spolsky/

@cowtowncoder
Copy link
Member

@cbsmith :-) -- thank you for sharing that, hadn't seen it.

@cowtowncoder cowtowncoder added 2.10 and removed 2.9 labels Sep 12, 2019
@Dimezis
Copy link

Dimezis commented Nov 7, 2019

@cowtowncoder
Is it planned to be fixed?
I can make a PR with a fix, if you wish.

@cowtowncoder
Copy link
Member

@Dimezis I have no active plan -- not aware of efficient way of doing this. So PR (or even to existing impl for other libraries) would be welcome.

@Dimezis
Copy link

Dimezis commented Nov 27, 2019

@cowtowncoder please check out the PR and let me know what you think #2554

cowtowncoder added a commit that referenced this issue Dec 6, 2019
@cowtowncoder
Copy link
Member

I added a failing test (slight modification from one in patch), and will see if it'd be easier to address that particular part (case-insensitive properties not matching), first, without worrying about naming strategy part.

@cowtowncoder cowtowncoder added 2.11 and removed 2.10 labels Dec 6, 2019
@cowtowncoder cowtowncoder added this to the 2.11.0 milestone Dec 6, 2019
@cowtowncoder
Copy link
Member

Ok, so: I fixed the first part, wherein case-insensitive deserialization should work with Turkish locale too (I have some work for 3.0.0/master to finish) up, and will file another for remaining work that is needed for PropertyNamingStrategy.

@cowtowncoder cowtowncoder changed the title i - I case convertion problem in Turkish locale i - I case conversion problem in Turkish locale Jan 3, 2020
@cowtowncoder cowtowncoder removed the 2.11 label Apr 12, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants