Skip to content

Unicode character in class name will fail to run #780

Closed
microsoft/java-debug
#383

Description

@wenzel-k

Unicode class names are not working, as they do in other ide's or via console.

Environment
  • Operating System: Windows 10
  • JDK version:1.11
  • Visual Studio Code version:
    1.43.0
  • Java Debugger extension version:
    0.25.1 - 2020-03-06
Steps To Reproduce
  1. [step 1]
    Create main class de.süper.SüperMain with any main method
  2. [step 2]
    Run it
Current Result

ConfigError: 'de.süper.SüperMain' is not a valid class name.

Expected Result

Should just run, as it will when compiled via bash console / bash maven

Activity

  1. testforstephen commented on Mar 23, 2020

    @testforstephen
    Contributor

    This error is a manual check from java debugger, we can fix it, but i'm afraid you may meet other problems at running class with unicode name. So please ignore this error first, and click "Fix" button to go on and see whether it works.

    And when i tried to use javac in CMD to compile a class with unicode in the file name, actually it won't succeed.

  2. wenzel-k commented on Mar 24, 2020

    @wenzel-k
    Author

    It is working out of the box with maven compile. For javac via console you have to add "javac -encoding utf8 SüperClass.java".
    Everything else regarding unicode is luckily working/running without a problem (now in 2020). I have an already deployed & running project (created with eclipse/maven) which i was trying to move to vscode now.

  3. testforstephen commented on Mar 24, 2020

    @testforstephen
    Contributor

    So please ignore this error first, and click "Fix" button to select the target class to go on and see whether it works.

    Ping again.

    ConfigError: 'de.süper.SüperMain' is not a valid class name. is easy to fix, but i need know whether there are other problems.

  4. wenzel-k commented on Mar 24, 2020

    @wenzel-k
    Author

    If i press 'Fix' and select the class to run an error shows up:
    Fehler: Hauptklasse SüperMain konnte nicht gefunden oder geladen werden Ursache: java.lang.ClassNotFoundException: SüperMain

  5. testforstephen commented on Mar 25, 2020

    @testforstephen
    Contributor

    Actually i get the same error when trying it in CMD and other IDEs like Eclipse/Intellij IDEA.

    Below are the steps i tried in CMD. javac works, but java execution will throw ClassNotFoundException.
    javac -encoding utf8 xyz
    java -Dfile.encoding=UTF-8 -cp . xyz

  6. wenzel-k commented on Apr 2, 2020

    @wenzel-k
    Author

    Here is a working example:

    Windows 10/openjdk 11.0.3 2019-04-16/Git Bash

    mkdir süper-app
    cd süper-app/
    mkdir de
    mkdir de/süper
    echo -e "package de.süper;\n\npublic class SüperClass {\n\tpublic static void main(String[] args) {\n\t\tjava.lang.System.out.println(\"Hello Unicode\");\n\t}\n}\n" > de/süper/SüperClass.java
    javac -encoding utf8 de/süper/SüperClass.java
    java de/süper/SüperClass
    

    Will print

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

Metadata

Metadata

Labels

Type

No type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions