mirror of
https://github.com/velopack/velopack.git
synced 2025-10-25 15:19:22 +00:00
bugfix: handle single/multiple ASCII characters
This commit is contained in:
@@ -30,7 +30,7 @@ namespace Squirrel
|
||||
{
|
||||
byte[] output = { };
|
||||
|
||||
if (content == null || content.Length < 2)
|
||||
if (content == null)
|
||||
{
|
||||
goto done;
|
||||
}
|
||||
|
||||
@@ -28,6 +28,9 @@ namespace Squirrel.Tests.Core
|
||||
var utf16LeHelloWorld = combine(utf16Le, Encoding.UTF8.GetBytes("hello world"));
|
||||
var utf8HelloWorld = combine(utf8, Encoding.UTF8.GetBytes("hello world"));
|
||||
|
||||
var asciiMultipleChars = Encoding.ASCII.GetBytes("hello world");
|
||||
var asciiSingleChar = Encoding.ASCII.GetBytes("A");
|
||||
|
||||
var emptyString = string.Empty;
|
||||
string nullString = null;
|
||||
byte[] nullByteArray = {};
|
||||
@@ -46,6 +49,9 @@ namespace Squirrel.Tests.Core
|
||||
Assert.Equal("hello world", Utility.RemoveByteOrderMarkerIfPresent(utf16BeHelloWorld));
|
||||
Assert.Equal("hello world", Utility.RemoveByteOrderMarkerIfPresent(utf16LeHelloWorld));
|
||||
Assert.Equal("hello world", Utility.RemoveByteOrderMarkerIfPresent(utf8HelloWorld));
|
||||
|
||||
Assert.Equal("hello world", Utility.RemoveByteOrderMarkerIfPresent(asciiMultipleChars));
|
||||
Assert.Equal("A", Utility.RemoveByteOrderMarkerIfPresent(asciiSingleChar));
|
||||
}
|
||||
|
||||
[Fact]
|
||||
|
||||
Reference in New Issue
Block a user