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

Use LiteralPaths for Get-ShortName #1

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

God-damnit-all
Copy link

Without this, filenames with certain Unicode characters (e.g. [char]0xA789) will erroneously receive the error that the file doesn't exist.

@riedyw
Copy link
Owner

riedyw commented Jul 12, 2021

I've run the function Get-ShortName with a test file that contains ([char]0xA789) as one of the filename characters in both Powershell 5.1 and pwsh 7.1.3 and I have no problems getting the shortname. Could you provide some details?

  1. which version of Powershell you are running
  2. what codepage is the console in? if you don't know run chcp and it will display the codepage
  3. what is the default encoding type running at the console? if you don't know run [Console]::OutputEncoding at a powershell prompt

@riedyw
Copy link
Owner

riedyw commented Jul 12, 2021

I was able to replicate your problem by attempting to enter Alt+A789 from the keyboard and it failed. Something to do with keyboard input handler.

When I attempt the keyboard input from a console running in ConEmu the command runs successfully. Again fingers point to the keyboard handler in the default console application.

@God-damnit-all
Copy link
Author

I ran into this issue initially through a script that iterated through tons of files via Get-ChildItem and ForEach-Object. I wish I had saved a snapshot of that script, because it's now changed so much that I'm having trouble replicating it.

It wouldn't hurt to merge this for rare edge cases, it's not like it hurts its functionality in any other way. But it's not as necessary as I first thought. I'm honestly quite frustrated that I can't get the issue to occur anymore, I'm not sure what changed.

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 this pull request may close these issues.

2 participants