Skip to content

jbang export gradle and UTF-8 #2359

@wfouche

Description

@wfouche

When experting a UTF-8 Java applications to a Gradle project, Unicode characters are not displayed correctly when though Windows is using code page 65001.

Step 1 - run Java program with JBang

C:\> jbang run JvmRuntimeOpts.java
--- 🚀 JVM Runtime Options (VM Arguments) ---
No explicit JVM Runtime Options found (default settings are in use).

--- 📝 Application Arguments ---
No Application Arguments were passed to the main method.

--- ✅ Execution Complete ---

Step 2 - export to Gradle run using Gradle

C:\> jbang export gradle JvmRuntimeOpts.java
C:\> cd  JvmRunTimeOpts
C:\> .\gradlew run
--- ? JVM Runtime Options (VM Arguments) ---
Option 1: -Dfile.encoding=UTF-8
Option 2: -Duser.country=ZA
Option 3: -Duser.language=en
Option 4: -Duser.variant

--- ? Application Arguments ---
No Application Arguments were passed to the main method.

--- ? Execution Complete ---

The fix is to also add Java runtime options:

  • -Dstdout.encoding=UTF-8
  • -Dstderr.encoding=UTF-8

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions