skywind3000 / skywind3000/z.lua

Zlua unable to deal with chinese char correctly after setting utf8 encoding in powershell.

Open
#203 2 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Lua
Stars
3.1k
Forks
148
PR merge metrics
No merged PRs in 30d

Description

After set the following in powershell, zlua unable to deal with chinese char correctly.

[Console]::OutputEncoding = [Console]::InputEncoding = [System.Text.Encoding]::utf8

The Error messeage:

PS D:\你好> z 你好
Push-Location : 找不到路径“D:\��”,因为该路径不存在。
所在位置 行:57 字符: 11
+             else { & "Push-Location" "$dest" }
+                    ~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : ObjectNotFound: (D:\��:String) [Push-Location], ItemNotFoundException
    + FullyQualifiedErrorId : PathNotFound,Microsoft.PowerShell.Commands.PushLocationCommand

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Reproduce the issue in PowerShell using the stated UTF-8 InputEncoding and OutputEncoding settings, from a directory containing Chinese characters. Start by tracing z.lua's PowerShell path-handling entry point and the Push-Location call shown in the error. Done means navigation preserves the Chinese path correctly and the reported failure no longer occurs.

Written by the indexing model from the issue text.

Assessment

Tech stack
lua, powershell
Domain
cli
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.