Trying to avoid a multi-byte character breaking.#55
Open
Oliverity wants to merge 2 commits intomorungos:developfrom
Open
Trying to avoid a multi-byte character breaking.#55Oliverity wants to merge 2 commits intomorungos:developfrom
Oliverity wants to merge 2 commits intomorungos:developfrom
Conversation
added 2 commits
January 12, 2024 16:05
Tries to prevent multi-byte characters from breaking. Unfortunately, we need to setEncoding() before actually reading contents, to avoid such breaking. Which means, we won't know the encoding yet. Right know UTF-8 is assumed, but OOXML files might be UTF-16 too. Haven't tested those as yet.
|
Works for me. Thanks. pnpm add 'github:Oliverity/node-word-extractor#develop'// package.json
{
"dependencies": {
// ...
"word-extractor": "github:Oliverity/node-word-extractor#develop"
}
} |
Author
Glad to hear that! And that's especially interesting since you probably deal a lot with the Chinese documents. Could you please tell me if the UTF-16 encoding is in a widespread use for those? |
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.
On the issue #54. Unfortunately, it seems we can only get the encoding from the XML heading if we read the stream, and we better assume the encoding before that to avoid the breaking. Here I assume the utf-8, but it wasn't tested on the *.docx files containing utf-16 XMLs inside.