-
Notifications
You must be signed in to change notification settings - Fork 9
fix: fixes UTF-16 encoding issues #202
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
Conversation
CodSpeed Performance ReportMerging #202 will not alter performanceComparing Summary
Footnotes
|
There was a problem hiding this 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 fixes UTF-16 encoding issues in source map generation by correctly handling multi-byte Unicode characters. The changes ensure that column positions in source maps are calculated using UTF-16 code units instead of UTF-8 bytes, which is required for proper JavaScript source map compatibility.
- Replaces all uses of
Cow<'a, str>with&'a strin chunk processing to simplify the API - Updates column offset calculations to use UTF-16 code unit counts instead of byte offsets
- Refactors remaining replacement handling to process replacements individually instead of concatenating them
Reviewed Changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 4 comments.
| File | Description |
|---|---|
| src/replace_source.rs | Core fix for UTF-16 column calculations; refactored replacement handling logic; added comprehensive test coverage for multi-byte Unicode |
| src/original_source.rs | Updated column calculations to use UTF-16 encoding; added test for multi-unit UTF-16 characters |
| src/helpers.rs | Changed OnChunk type signature from Cow<'b, str> to &'b str; updated all call sites |
| src/cached_source.rs | Minor reordering of struct fields |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
3a7b5de to
5b28db1
Compare
4792cee to
702d86b
Compare
cfa2c78 to
3f7670a
Compare
This PR fixes UTF-16 encoding issues in source map generation by correctly handling multi-byte Unicode characters. The changes ensure that column positions in source maps are calculated using UTF-16 code units instead of UTF-8 bytes, which is required for proper JavaScript source map compatibility.
Cow<'a, str>with&'a strin chunk processing to simplify the API