-
Notifications
You must be signed in to change notification settings - Fork 7.1k
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
Add Get-FileEncoding cmdlet or function. #2290
Comments
Do you mean this? This suggests that need the following cmdlets: Convert-FileEncoding and Convert-StringEncoding And the RFC is required. |
@iSazonov Yes. The additional cmdlets are nice to haves as well. |
|
I investigated this field. It is questionable. We need the reference algorithm from experts in the field. |
For compatibility we need to use the ported file utility. Can we rewrite it on C# and include in the repo as cmdlet? |
Posted by @sdwheeler in our Community Call, this is a version from Lee: http://poshcode.org/2153 |
@PowerShell/powershell-committee discussed this and recommendation is to have a cmdlet that supports this capability instead of adding to FileInfo. Usage will be more common now that we are cross platform and should be part of the Utility module. Get-FileEncoding and Convert-FileEncoding makes sense from a discovery standpoint. Seems we can just review the parameters at PR time rather than requiring RFC for this one. |
@joeyaiello If we do a different algorithm then @SteveL-MSFT Could you please clarify about the possibility of porting of |
@iSazonov porting file as a cmdlet makes sense (assuming appropriate licensing). alternatively since I see the |
Our conclusion on this issue was specifically about wanting better support for encodings, nothing more. I think we also questioned the value in porting |
@SteveL-MSFT We cannot expect that there is the Today I am more deeply researched how Another bad news is that this utility does not detect codepages. Do we want to make detection of codepages? If so, do we want high-speed heuristics (sample) or will use simpler but slower ways? Now about the conversion. Simple test: [text.encoding]::GetEncodings().count return Should we completely rely on .Net Core in the expectation that there will be support for multiple charsets? Or should we make our implementation? |
@SteveL-MSFT for me I was just looking for detection of encodings that existing cmdlets currently accept such as Out-File. No code page usage. I do see the value in a full set of encoding cmdlets though. |
Opened - Initial discussion about encoding cmdlets PowerShell/PowerShell-RFC#67 |
@iSazonov: As an aside re:
That said, the focus of the POSIX In practice, however, both the GNU and the BSD/macOS implementations do report a text file's encoding, including the presence/absence of the UTF-8 pseudo-BOM. |
@mklement0 Thank you mentioned this utility as POSIX. In most cases, however, it is installed as part of a separate package. This should encourage us to require the installation of this utility when installing PowerShell Core. I believe it is unacceptable for us. And welcome to discussion PowerShell/PowerShell-RFC#67 |
I'm not (nearly) as advanced a PowerShell user as you guys, and I have a weak understanding of file encoding (I don't have a clue what the point of a Both required tools ( |
@roysubs This was approved and you can grab the work. |
I really wish that I had the ability to do that @iSazonov ! I know that @mklement0 has a very deep understanding of file encoding, I'm hoping that he might have the time to build this... 🙂 |
@mklement0 is a great analytic but not a fan of coding :-) Implementation is simple with using StreamReader.CurrentEncoding . Of cause later we could make the cmdlet more "powershel-ly" smart with an heuristics. |
Sounds great, and I'll help if I can, but presumably you'd have to do this in C# (I'm more of just a SysAdmin / DevOps type scripter, I just use PowerShell and Python to manage some tasks on my work environments). I want to see PowerShell take over on Linux though, it's just a much better language imo 🙂. |
This issue has not had any activity in 6 months, if there is no further activity in 7 days, the issue will be closed automatically. Activity in this case refers only to comments on the issue. If the issue is closed and you are the author, you can re-open the issue using the button below. Please add more information to be considered during retriage. If you are not the author but the issue is impacting you after it has been closed, please submit a new issue with updated details and a link to this issue and the original. |
This is common task I see across many PowerShell modules and think it would add value for cross platform tasks.
The text was updated successfully, but these errors were encountered: