Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Special characters in Julia ARGS #835

Open
raphasampaio opened this issue Aug 3, 2023 · 0 comments · May be fixed by #1008
Open

Special characters in Julia ARGS #835

raphasampaio opened this issue Aug 3, 2023 · 0 comments · May be fixed by #1008
Labels

Comments

@raphasampaio
Copy link

raphasampaio commented Aug 3, 2023

  1. version info:
Julia Version 1.9.2
Commit e4ee485e90 (2023-07-05 09:39 UTC)
Platform Info:
  OS: Windows (x86_64-w64-mingw32)
  CPU: 8 × 11th Gen Intel(R) Core(TM) i7-1165G7 @ 2.80GHz
  WORD_SIZE: 64
  LIBM: libopenlibm
  LLVM: libLLVM-14.0.6 (ORCJIT, tigerlake)
  Threads: 1 on 8 virtual cores
Environment:
  JULIA_192 = "D:\Program Files\Julia-1.9.2\bin\julia.exe"
  1. I downloaded the portable version and created the %JULIA_192% environment variable.
  2. To reproduce, you should compile the following program:

src/Application.jl:

module Application

function main(args)
    @show args
    return nothing
end

function julia_main()::Cint
    main(ARGS)
    return 0
end

end

main.jl:

import Pkg
Pkg.instantiate()

using Application
Application.main(ARGS)

compile/compile.jl:

using PackageCompiler 

function compile()
    package_path = dirname(@__DIR__)
    build_path = joinpath(@__DIR__, "build")

    if isdir(build_path)
        rm(build_path, force = true, recursive = true)
    end
    mkdir(build_path)

    PackageCompiler.create_app(
        package_path,
        build_path,
        executables = ["Application" => "julia_main"],
        force = true,
    )
    return nothing
end

compile()

And run the compiled application with a special character argument:

Application.exe "d:\áéíóú"
args = ["d:\\\xe1\xe9\xed\xf3\xfa"]

However, it works fine with the Julia-interpreted version:

%JULIA_192% --project main.jl "d:\áéíóú"
args = ["d:\\áéíóú"]

There may be a missing parsing step in embedding_wrapper.c for UTF8 string conversion. Ready to assist/test as needed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants