Skip to content
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

修复ConvertFromUtf16BEBytesToUtf8BOMBytes方法 #4

Closed
wants to merge 3 commits into from

Conversation

execute233
Copy link
Contributor

用一种简单粗暴的方式让它带上BOM了

@lc6464 lc6464 self-requested a review September 13, 2023 14:30
Copy link
Owner

@lc6464 lc6464 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

var temp = Encoding.Convert(Encoding.BigEndianUnicode, new UTF8Encoding(), data.ToArray());
var bom = new byte[]{ 0xEF, 0xBB, 0xBF };
var result = bom.Concat(temp).ToArray();
return new ReadOnlySpan<byte>(result);
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

我觉得 L25 和 L26 肯定可以优化,另外就是这个 BOM 应该提取出来。

Text.cs Outdated Show resolved Hide resolved
@lc6464
Copy link
Owner

lc6464 commented Sep 13, 2023

@lc6464
Copy link
Owner

lc6464 commented Sep 13, 2023

放弃这个 PR 了。
详见 aa5a899

@lc6464 lc6464 closed this Sep 13, 2023
@execute233
Copy link
Contributor Author

6

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants