apache / apache/fory

Fury does not preserve script/extensions following serialise/deserialise

Open
#3,966 1 comment 0 reactions 0 assignees View on GitHub
bug
Dominant language
Java
Stars
4.5k
Forks
443
Avg merge
6h 3m
Merged PRs (30d)
74

Description

### Search before asking

- [x] I had searched in the [issues](https://github.com/apache/fory/issues) and found no similar issues.

### Version

Fury only serialises the language/country/variant fields of a Locale, ignoring any script/extensions, resulting in an inconsistent values following deserialisation.

### Component(s)

Java

### Minimal reproduce step

On my machine:
```
Fory fory = Fory.builder().withLanguage(Language.JAVA).build();
for (Locale locale : Locale.getAvailableLocales()) {
Locale deserialised = fory.deserialize(fory.serialize(locale));
assertEquals(locale, deserialised); // This fails for locales that define a script or extensions
}
```

### What did you expect to see?

Assertions should pass.

### What did you see instead?

The assertion fails for any locale that defines a script or extensions.

### Anything Else?

_No response_

### Are you willing to submit a PR?

- [ ] I'm willing to submit a PR!

Contributor guide

Open the contributing guide

Research direction

Start with Fury's Java serialization handling for java.util.Locale and run the provided round-trip over Locale.getAvailableLocales(). Ensure the round-tripped Locale equals the original for locales with scripts or extensions, while preserving the existing language, country, and variant behavior.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
backend
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Active
Clarity
Mostly clear
Newbie friendliness
68/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.