Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8268719

Force execution (and source) code page used when compiling on Windows

XMLWordPrintable

    • b15

      A while ago there was a discussion around JDK-8263028 where it seems that one of the issue was caused by the code page setting on the build system.

      At the time we tried a few things, but didn't find a way to set the code page used by MSVC explicitly.

      Now, when looking at character encodings again, I've stumbled upon the options `/execution-charset` [1] and `/source-charset` [2], which seems to allow setting the code page when invoking the compiler with e.g.

          /execution-charset:.437 /source-charset:.437

      To force the used code page to be the same as on a Windows system with the English locale set as system locale.

      Maybe it could be considered to use these flags to avoid code page problems in the future.


      FWIW, GCC and Clang seem to have equivalent options under the names `-finput-charset` and `-fexec-charset`.

      MSVC also has the option /utf-8 to set both charsets to utf-8, so maybe UTF-8 could be adopted as the official encoding for both (AFAICS, UTF-8 is the default used by GCC and Clang).

      [1] : https://docs.microsoft.com/en-us/cpp/build/reference/execution-charset-set-execution-character-set?view=msvc-160
      [2] : https://docs.microsoft.com/en-us/cpp/build/reference/source-charset-set-source-character-set?view=msvc-160

            bstafford Brian Stafford
            jvernee Jorn Vernee
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: