Skip to content
New issue

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

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

Already on GitHub? # to your account

Different encodings in different lua functions #415

Open
jankatins opened this issue Aug 8, 2016 · 0 comments
Open

Different encodings in different lua functions #415

jankatins opened this issue Aug 8, 2016 · 0 comments

Comments

@jankatins
Copy link

This is from cmderdev/cmder#1054

Basically I want to set clink.prompt.value = clink.get_cwd().

function debug_s(n, str)
    file = io.open("c:\\temp\\test.txt", "a")
    io.output(file)
    io.write(n.."("..type(str).."): ")
    if type(str) == "string" then
        io.write(str)
    else
        io.write(dump(str))
    end
    io.write("\n")
    io.close(file)

end

function debug_prompt_filter()
        debug_s("cwd", clink.get_cwd())
        debug_s("prompt", clink.prompt.value)
end

clink.prompt.register_filter(debug_prompt_filter, 0)

creating a folder called c:\temp\ü and changing to it, this results in the following file (ANSI encoded):

cwd(string): c:\temp\ü
prompt(string): c:\temp\ü>

I interpret that as that the original clink.prompt.value is encoded UTF8 (ü as utf8 codepoints is c3 bc, which then gets interpreted as ü in windows-1252) and get_cwd() returns windows-1252.

Is there any way to get (and set) unicode in both sides?

chrisant996 added a commit to chrisant996/clink that referenced this issue Oct 10, 2020
This should resolve issue 415 in mridgers/clink (for almost all of the
lua functions, not just the one specifically mentioned there).

[#415](mridgers/clink#415)
Different encodings in different lua functions
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant