Oftentimes people find it difficult to interact between Windows, Java and a console when it comes to Unicode. Support in Windows for Unicode is very limited in cmd.exe and it's better to turn to Powershell. The first step is to ensure that UTF-8 support is enabled, hence the first command below. All commands have been highlighted.

  1. Enable full Unicode support
  2. Create a file with a name that's an obvious candidate for Unicode encoding
  3. Verify that the file was created
  4. Show the code of a Java app that interacts with this file
  5. Run the app, passing an argument to it
PS C:\Users\goose> [Console]::InputEncoding = [Console]::OutputEncoding = New-Object System.Text.UTF8Encoding

PS C:\Users\goose> New-Item два.mp4

    Directory: C:\Users\goose


Mode                 LastWriteTime         Length Name
----                 -------------         ------ ----
-a----        27/05/2024     21:06              0 два.mp4


PS C:\Users\goose> gci -Filter *.mp4


    Directory: C:\Users\goose


Mode                 LastWriteTime         Length Name
----                 -------------         ------ ----
-a----        27/05/2024     11:35              0 два.mp4

PS C:\Users\goose> get-content TestFileArgument.java
import java.nio.file.Files;
import java.nio.file.Path;

public class TestFileArgument {
    public static void main(String[] args) {
        String fileName = args[0];
        Path p = Path.of(fileName);
        System.out.println(p);
        System.out.println(Files.exists(p));
    }
}
PS C:\Users\goose> java TestFileArgument два.mp4    
два.mp4
true
PS C:\Users\goose>