-
Notifications
You must be signed in to change notification settings - Fork 7.7k
Unify file encoding when a cmdlet creates a file #4119
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
Closed
JamesWTruher
wants to merge
14
commits into
PowerShell:master
from
JamesWTruher:jameswtruher/encoding3
Closed
Changes from 1 commit
Commits
Show all changes
14 commits
Select commit
Hold shift + click to select a range
965d325
Unify file encoding and set new default to UTF8 without BOM
JamesWTruher afbf374
Fix test issue where newline was being provided rather than calculated
JamesWTruher f996e6f
Remove code which was relying on previous encoding code
JamesWTruher a067de4
fix another couple of xplat issues
JamesWTruher 9b8e4fb
Return static Utf8NoBom encoder rather than creating a new instance
JamesWTruher 5309b90
Change expected encoding to not distinguish based on platform except …
JamesWTruher 9a45f40
Remove commented out code
JamesWTruher 65c255c
refactor tests to use fewer instances of hardcoded byte strings
JamesWTruher 14933a9
update tests to include tests against Encoding probe method for exist…
JamesWTruher acac547
Refactor Encoding.cs to improve readability
JamesWTruher 40a8eee
Change FileEncoding.Unknown to FileEncoding.Unspecified which more cl…
JamesWTruher bf2be6f
Changed PowerShellEncoding class name to EncodingUtils
JamesWTruher 8a0765e
update PowerShellEncoding to use new name EncodingUtils
JamesWTruher ff24e22
Use new class name EncodingUtils
JamesWTruher File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Changed PowerShellEncoding class name to EncodingUtils
made file encoding probe method internal
- Loading branch information
commit bf2be6fd369ceec7f3178b9649ee4ba5df09dae9
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -96,7 +96,7 @@ public enum FileEncoding | |
/// <summary> | ||
/// the helper class for determining encodings for PowerShell | ||
/// </summary> | ||
public static class PowerShellEncoding | ||
public static class EncodingUtils | ||
{ | ||
|
||
/// <summary> | ||
|
@@ -232,7 +232,7 @@ public static Encoding GetEncoding(Cmdlet cmdlet, FileEncoding encoding) | |
/// <param name="path">The path to a file to inspect for an encoding</param> | ||
/// <returns>System.Text.Encoding</returns> | ||
/// </summary> | ||
public static FileEncoding GetFileEncodingFromFile(string path) | ||
internal static FileEncoding GetFileEncodingFromFile(string path) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Seems like this should be |
||
{ | ||
if (!File.Exists(path)) | ||
{ | ||
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks like this line is no longer needed.