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

Deserializing locale assumes JDK separator (underscore), does not accept RFC specified (hyphen) #1344

Closed
mcdee opened this issue Aug 23, 2016 · 2 comments
Milestone

Comments

@mcdee
Copy link

mcdee commented Aug 23, 2016

When deserializing a locale Jackson currently uses the underscore character as the separator rather than the dash. Specifically, in FromStringDeserializer.java line 234:

int ix = value.indexOf('_');

Many locale implementations use dash as the separator as per https://tools.ietf.org/html/rfc5646

Given the RFC states that only the characters a-z A-Z and - are valid it should be possible to leave the current code in for backward-compatibility but it should also check for '-' as a separator.

@mcdee mcdee changed the title Deserializing locale uses incorrect separator Deserializing locale uses non-standard separator Aug 23, 2016
@cowtowncoder
Copy link
Member

@mcdee Thank you for reporting this: sounds like a bug indeed.

Do you know of an existing JDK provided Locale value that would exhibit this? Would be great to have a unit test against regression, beyond fixing the issue itself.

@cowtowncoder
Copy link
Member

Actually I think JDK always uses underscore, so I'll have to just test deserializer with made-up codes.

@cowtowncoder cowtowncoder changed the title Deserializing locale uses non-standard separator Deserializing locale assumes JDK separator (underscore), does not accept RFC specified (hyphen) Aug 25, 2016
@cowtowncoder cowtowncoder added this to the 2.7.7 milestone Aug 25, 2016
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

2 participants