Skip to content

Test testToString fails with locale set to de_DE.UTF-8 #375

Closed as not planned

Description

@zupatisc

Using java 11 I get this when trying to build

Failed tests: testToString(com.microsoft.java.debug.core.adapter.formatter.NumericFormatterTest): NumericFormatter should be able to format double correctly. expected:<111[.]000000> but was:<111[,]000000>
This looks like it could be caused by my locale? It's set to de_DE.UTF-8

Edit: Yes it is caused by my locale, setting LC_ALL=en_US.UTF-8 makes it compile without issue

Activity

  1. changed the title [-]Test testToString fails[/-] [+]Test testToString fails with locale set to de_DE.UTF-8[/+] on May 9, 2021
  2. nela commented on Feb 9, 2022

    @nela

    I am experiencing the same issue, even though locale is en_US and am unable to build the project.

    Error message:

    Failed tests:   testToString(com.microsoft.java.debug.core.adapter.formatter.NumericFormatterTest): NumericFormatter should be able to format double correctly. expected:<111[.]000000> but was:<111[,]000000>
    

    Locale:

    $ env | grep LC
    LC_CTYPE=UTF-8
    LC_ALL=en_US.UTF-8
    

    Java Version:

    $ java --version
    openjdk 11 2018-09-25
    OpenJDK Runtime Environment 18.9 (build 11+28)
    OpenJDK 64-Bit Server VM 18.9 (build 11+28, mixed mode)
    

    OS:
    macOs 12.1 Monterey

  3. mweisshaupt1988 commented on Aug 4, 2022

    @mweisshaupt1988

    This affects me too. The test should not assume that the separator for double is '.'

    OS:
    Ubuntu 20.04

    Locale:
    env | grep LC
    LC_ADDRESS=de_DE.UTF-8
    LC_NAME=de_DE.UTF-8
    LC_MONETARY=de_DE.UTF-8
    LC_PAPER=de_DE.UTF-8
    LC_IDENTIFICATION=de_DE.UTF-8
    LC_TELEPHONE=de_DE.UTF-8
    LC_MEASUREMENT=de_DE.UTF-8
    LC_TIME=de_DE.UTF-8
    LC_NUMERIC=de_DE.UTF-8

  4. github-actions commented on Nov 14, 2025

    @github-actions

    Hi zupatisc, I'm an AI Support assistant here to help with your issue. While the team reviews your request, I wanted to provide some possible tips and documentation that might help you in the meantime.

    Suggestions

    • Enforce a consistent locale when formatting numbers:

      • In your test or setup code, call:
        Locale.setDefault(Locale.US);
      • In Maven Surefire, add to your pom.xml:
        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-surefire-plugin</artifactId>
          <configuration>
            <systemPropertyVariables>
              <user.language>en</user.language>
              <user.country>US</user.country>
            </systemPropertyVariables>
          </configuration>
        </plugin>
        (See: https://maven.apache.org/surefire/maven-surefire-plugin/test-mojo.html)
      • Or run tests via:
        mvn test -Duser.language=en -Duser.country=US
    • Update your formatter to use a locale-specific API, e.g.:

      String result = String.format(Locale.US, "%.6f", 111.0);

    Duplicate

    Other references with low confidence

    The team will respond to your issue shortly. I hope these suggestions are helpful in the meantime. If this comment helped you, please give it a 👍. If the suggestion was not helpful or incorrect, please give it a 👎. Your feedback helps us improve!

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

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions