Skip to content

Fury does not preserve script/extensions following serialise/deserialise #3966

Open

Description

@pferraro

Search before asking

  • I had searched in the 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!

Activity

  1. FireStorm8142 commented on Aug 26, 2026

    @FireStorm8142

    The issue that i found is in 'LocaleSerializer.java'

    private static final Map<Tuple3<String, String, String>, Locale> LOCALE_CACHE = new HashMap<>(createCacheMap());

    only serializes 3 fields, ignoring scripts & extensions.
    LOCALE_CACHE also uses a 'Tuple3' so it can't distinguish Locales differing in scripts and extensions.

    I'm working on a solution to extend the serialization to include those 2 fields.

  2. dhruv9b commented on Sep 17, 2026

    @dhruv9b

    @FireStorm8142 Are you still working on this issue?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions