Skip to content

Locale-dependent formatting: String.format / toUpperCase / toLowerCase without Locale.ROOT in generated code and the reference port #3823

Closed

Description

@squid-protocol

What:

  • String.format("%d") prints localised digits. Probe on JDK 17: ar-EG gives G٠٠٠٧V00; fa-IR, mr-IN, bn-BD, my-MM and th-TH-u-nu-thai all give non-ASCII digits. %.2f gives 1234,50 under de-DE.
  • Turkish casing: "PINK".toLowerCase() gives pınk.

Where:

  • cobol_to_java_batch_forge.py:444: String.format("G%04dV00", …). latest() matches G\d{4}V00, and Java's \d is ASCII-only, so a generation written with Arabic-Indic digits is never found (inferred, not run).
  • The reference port tests/equivalence/carddemo-intcalc/port/service/Cbact04cService.java:198,202,218.
  • cobol_to_java_screen_forge.py:242 (toLowerCase of the colour class).
  • call_forge.py:340 and batch_forge.py:487,529 (toUpperCase).

Test: Run carddemo-intcalc with -Duser.language=ar -Duser.country=EG. Expected: identical output. Also run the screens under tr-TR.

Fix:

  • Pass Locale.ROOT to every format and case-mapping call in the templates and the exemplar.
  • Add a porting rule.
  • Pin the locale in the generated pom / application.yml, and run the harness under a hostile locale.

(The Python engine already folds ı/i̇: rule_prefilter.py:168.)

Found by a cultural-assumptions audit (2026-09-26): confirmed in code or by probe (JDK 17 locales, IBM code-page decoding, the harness's GnuCOBOL image) unless marked plausible.

🤖 Generated with Claude Code

Activity

  1. added
    bug
    legacy-modernization
    on Sep 26, 2026
  2. added a commit that references this issue on Sep 26, 2026
  3. added 3 commits that reference this issue on Sep 27, 2026
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

    buglegacy-modernization

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions