fix: wchar handling#107
Merged
ahmad-kemsan merged 4 commits intomasterfrom Apr 10, 2026
Merged
Conversation
|
There was a problem hiding this comment.
Pull request overview
This PR fixes wide character (wchar) handling for cross-platform compatibility between Windows (UTF-16) and Unix-based systems (UTF-8). The fix addresses an issue where character buffer sizes were incorrectly calculated on Windows, which uses 2-byte UTF-16 encoding (wchar_t).
Key Changes:
- Added platform-specific character count calculation in C++ to properly handle UTF-16 on Windows
- Introduced a TypeScript helper function to allocate appropriately sized buffers based on platform encoding
- Applied these changes consistently across 30+ API functions
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 26 comments.
| File | Description |
|---|---|
| src/native/main.cpp | Added getCharCount() function to convert byte lengths to character counts (dividing by 2 on Windows for UTF-16), and updated all buffer length calculations to use this function with proper error handling |
| src/lexactivator-native.ts | Added getCArray() function to allocate buffers with correct byte sizes (doubled on Windows for UTF-16 encoding) |
| src/lexactivator.ts | Replaced all direct Uint8Array instantiations with calls to getCArray() to ensure proper buffer allocation across platforms |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
ahmad-kemsan
approved these changes
Jan 2, 2026
added 2 commits
February 24, 2026 12:21
|
ahmad-kemsan
approved these changes
Mar 19, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.


No description provided.