Tar methods wrongly use the term "ASCII" for non-encoded string bytes
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 3/5
- Thời gian dự kiến
- 1-2 ngày
- Mức phù hợp với người mới
- 35/100
Hướng nghiên cứu
Bắt đầu tại src/ICSharpCode.SharpZipLib/Tar/TarHeader.cs ở dòng 1088 và tái hiện hành vi bằng ví dụ .NET Fiddle được liên kết. So sánh GetAsciiBytes với null và với Encoding.ASCII, sau đó xác minh rằng trường hợp null có hành vi như mong đợi và cân nhắc cách đặt tên của helper theo yêu cầu.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
Steps to reproduce
public static void Main()
{
var s1_UTF_16 = "ABC网络D";
var b1_UTF_16 = Encoding.Unicode.GetBytes(s1_UTF_16);
var buffer_UTF_16_default = new byte[b1_UTF_16.Length];
var buffer_UTF_16_ASCII = new byte[b1_UTF_16.Length];
var buffer_UTF_16_UTF8 = new byte[b1_UTF_16.Length];
var buffer_UTF_16 = new byte[b1_UTF_16.Length];
GetAsciiBytes(s1_UTF_16, 0, buffer_UTF_16_default, 0, buffer_UTF_16_default.Length, null);
GetAsciiBytes(s1_UTF_16, 0, buffer_UTF_16_ASCII, 0, buffer_UTF_16_ASCII.Length, Encoding.ASCII);
GetAsciiBytes(s1_UTF_16, 0, buffer_UTF_16_UTF8, 0, buffer_UTF_16_UTF8.Length, Encoding.UTF8);
GetAsciiBytes(s1_UTF_16, 0, buffer_UTF_16, 0, buffer_UTF_16.Length, Encoding.Unicode);
var defaultBufferedString = Encoding.ASCII.GetString(buffer_UTF_16_default);
var asciiBufferedString = Encoding.ASCII.GetString(buffer_UTF_16_ASCII);
var utf8BufferedString = Encoding.UTF8.GetString(buffer_UTF_16_UTF8);
var utf16BufferedString = Encoding.Unicode.GetString(buffer_UTF_16);
WriteToConsole(nameof(defaultBufferedString), defaultBufferedString);
WriteToConsole(nameof(asciiBufferedString), asciiBufferedString);
WriteToConsole(nameof(utf8BufferedString), utf8BufferedString);
WriteToConsole(nameof(utf16BufferedString), utf16BufferedString);
var b_asciiConvertResult = Encoding.Convert(Encoding.Unicode, Encoding.ASCII, b1_UTF_16);
var s_asciiConvertResult = Encoding.ASCII.GetString(b_asciiConvertResult);
WriteToConsole(nameof(s_asciiConvertResult), s_asciiConvertResult);
void WriteToConsole<T>(string nameOf, T value) => Console.WriteLine($"{nameOf} => \"{value}\"");
}
Expected behavior
Calling GetAsciiBytes and passing parameter encoder null should behave the same as passing Encoding.ASCII
Actual behavior
Calling GetAsciiBytes and passing parameter encoder null converts some non-ASCII characters into ASCII characters without encoding
Version of SharpZipLib
Obtained from (only keep the relevant lines)
- Copied method from GitHub
Also, you may want to reconsider the name of this helper method
- Ngôn ngữ chính
- C#
- Star
- 3.9k
- Fork
- 1k
- Chỉ số merge pull request
- Không có pull request nào được merge trong 30 ngày
Chuẩn bị môi trường
- Không có Dockerfile hay tệp Docker Compose
- Có mẫu pull request
- Đọc hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của icsharpcode/SharpZipLib
-
*no response* bug
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 78/100
icsharpcode/SharpZipLib#905 · 1 bình luận ·
-
bug bzip2
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 45/100
icsharpcode/SharpZipLib#904 ·
-
SetLevel in ZipFileĐang mởenhancement zip
Độ khó 2/5 1-2 ngày Mức phù hợp với người mới 55/100
icsharpcode/SharpZipLib#903 ·
-
*no response* bug
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 32/100
icsharpcode/SharpZipLib#901 · 1 bình luận ·
-
*no response* bug
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 35/100
icsharpcode/SharpZipLib#894 · 1 bình luận ·
Tất cả issue của icsharpcode/SharpZipLib
Issue tương tự
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
umbraco/Umbraco.Automate#612 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
崩溃日志只按 CRLF 分行Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
PCL-Community/PCL-CE#3872 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
type:task ux
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
elsa-workflows/elsa-foundation#5253 ·
Maintainer thường phản hồi trong vòng 1 ngày