Skip to content

将 URI 中的错误代理对编码为 U+FFFD#4329

Merged
Glavo merged 2 commits intoHMCL-dev:mainfrom
Glavo:uri
Aug 24, 2025
Merged

将 URI 中的错误代理对编码为 U+FFFD#4329
Glavo merged 2 commits intoHMCL-dev:mainfrom
Glavo:uri

Conversation

@Glavo
Copy link
Copy Markdown
Member

@Glavo Glavo commented Aug 24, 2025

相比 ?(%3F),U+FFFD (replacement character) 更能明确表示这是一个错误字符。

@Glavo Glavo requested a review from Copilot August 24, 2025 12:28
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR changes the encoding behavior for invalid surrogate pairs in URIs from a question mark (?) to the Unicode replacement character U+FFF0.

  • Updates invalid surrogate pair handling to use U+FFF0 instead of encoding as %3F (question mark)

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

Comment on lines +189 to +190
// Invalid surrogate pair, encode as U+FFF0
encodeCodePoint(builder, 0xfff0);
Copy link

Copilot AI Aug 24, 2025

Choose a reason for hiding this comment

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

Using U+FFF0 (0xfff0) as a replacement character is non-standard. The Unicode standard defines U+FFFD as the official replacement character for invalid or unrepresentable characters. Consider using 0xfffd instead.

Suggested change
// Invalid surrogate pair, encode as U+FFF0
encodeCodePoint(builder, 0xfff0);
// Invalid surrogate pair, encode as U+FFFD
encodeCodePoint(builder, 0xfffd);

Copilot uses AI. Check for mistakes.
@Glavo Glavo changed the title 将 URI 中的错误代理对编码为 U+FFF0 将 URI 中的错误代理对编码为 U+FFFD Aug 24, 2025
@Glavo Glavo requested a review from Copilot August 24, 2025 12:33
@Glavo Glavo merged commit 933b7ca into HMCL-dev:main Aug 24, 2025
2 checks passed
@Glavo Glavo deleted the uri branch August 24, 2025 14:27
@Glavo Glavo review requested due to automatic review settings March 23, 2026 21:27
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.

2 participants