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

Broken characters of dir when I use -print-last-dir option / change drive option /d in lfcd.cmd #1769

Closed
Jaehaks opened this issue Jul 5, 2024 · 3 comments · Fixed by #1772

Comments

@Jaehaks
Copy link
Contributor

Jaehaks commented Jul 5, 2024

Thank you for your efforts,

I'm Windows user and using lf really well.

First, In order to get lfcd to change directory between drives, It would be better to add /d to cd

for /f "usebackq tokens=*" %%d in (`lf -print-last-dir %*`) do cd /d %%d

Second, lf -print-last-dir print broken characters when the path has non-english words.
Is It encoding issue?

@joelim-work
Copy link
Collaborator

Thanks, you are welcome to submit a PR to add in the /d flag.

Regarding non-english words, it looks like lf -print-last-dir works fine by itself, and the problem is with the lfcd.cmd script. I don't know how to deal with it though.

@joelim-work
Copy link
Collaborator

Actually I did some research, if you change the console to use UTF-8, does it work? Add the following at the top of the lfcd.cmd script:

chcp 65001 > nul 2>&1

@Jaehaks
Copy link
Contributor Author

Jaehaks commented Jul 5, 2024

Actually I did some research, if you change the console to use UTF-8, does it work? Add the following at the top of the lfcd.cmd script:

chcp 65001 > nul 2>&1

Thank you for your advice,
It works!!
I'll submit PR with solution of this issue.

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

Successfully merging a pull request may close this issue.

2 participants