Add UTF-16 option to Base64 encoder/decoder#63
Add UTF-16 option to Base64 encoder/decoder#63dchristensen wants to merge 4 commits intoDevToys-app:mainfrom
Conversation
|
I realized I failed to actually output the BOM when encoding a Unicode string. As I've been going through to add that I've found some existing code in the codebase that I have questions about. In the I've found the related issue (DevToys-app/DevToys#342) and PR (DevToys-app/DevToys#378) that appears to have driven this change. I find it strange that the preamble is included in the plain-text output. The Preamble seems like it should be an implementation detail of the encoding when converting characters to bytes. The same string could be encoded with or without a preamble depending on the encoder settings. |
Adds the UTF-16 encoding type to the Base64 encoder/decoder
Pull request type
Please check the type of change your PR introduces:
What is the current behavior?
The Base64 encoder/decoder does not support UTF-16 encoding. This encoding is commonly used when working with PowerShell as it supports encoding commands using the
powershel.exe -EncodedCommandoption.Issue Number: DevToys-app/DevToys#661
What is the new behavior?
Other information
This only adds support for UTF-16LE with BOM (
System.Text.Encoding.Unicode). I considered adding UTF-16LE and UTF-16BE explicitly as well, but felt that might clutter the UI with too many options. I think UTF-16LE BOM will be sufficient for most use-cases (PowerShell supports UTF-16LE with BOM).Quality check
Before creating this PR: