Resolve UTF-8 encoding and IPC issues in Search plugin#859
Open
LakatosMark1 wants to merge 1 commit into
Open
Conversation
Forces UTF-8 encoding in the C++ layer and rewrites the Java IOHelper to properly decode multi-byte UTF-8 characters.
Open
Open
Contributor
There was a problem hiding this comment.
Pull request overview
This PR addresses character encoding problems in the Search plugin’s Java subprocesses by forcing UTF-8 at process launch and by fixing Java stream-to-string reading to correctly handle multi-byte UTF-8 characters.
Changes:
- Add
-Dfile.encoding=UTF-8to the Java command lines used to launch the search service and indexer. - Rewrite
IOHelper.readFullContent(...)to build strings via bufferedchar[]reads instead of byte-collecting. - Change file reading in
Contextto use an explicit UTF-8InputStreamReader.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| plugins/search/service/include/service/serviceprocess.h | Forces UTF-8 as the default Java process encoding for the search service subprocess. |
| plugins/search/indexer/src/indexerprocess.cpp | Forces UTF-8 as the default Java process encoding for the indexer subprocess. |
| plugins/search/indexer/indexer-java/src/cc/search/indexer/util/IOHelper.java | Fixes full-stream reading to avoid corrupting multi-byte characters. |
| plugins/search/indexer/indexer-java/src/cc/search/indexer/Context.java | Switches file decoding to an explicit UTF-8 reader for indexing. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
63
to
66
| try (FileInputStream stream = new FileInputStream(file_)) { | ||
| String fileContent = IOHelper.readFullContent( | ||
| IOHelper.getReaderForInput(stream)); | ||
| new InputStreamReader(stream, StandardCharsets.UTF_8)); | ||
|
|
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.
Forces UTF-8 encoding in the C++ layer and rewrites the Java IOHelper to properly decode multi-byte UTF-8 characters.
Related to #850.