Repository navigation
Fix Full-width spaces replaced by half-width spaces when importing subtitles #1840 - #1842
Merged
Merged
Conversation
…btitles #1840 Some white space characters (like U+3000) were bring removed or converted by the html conversion and simplified() Simplified was replaced with trimmed(). Html conversion is avoided unless we are certain that the line has HTML.
Contributor
There was a problem hiding this comment.
Pull request overview
Fixes preservation of full-width spaces (U+3000) when importing SRT subtitles by avoiding QString::simplified() and skipping HTML-to-plain-text conversion unless HTML syntax is actually detected.
Changes:
- Detect HTML syntax via
Qt::mightBeRichText()plus regex matching for tags/entities before invokingQTextDocumentFragment::fromHtml(). - Replace
simplified()withtrimmed()so internal whitespace (including U+3000) is preserved.
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.
Some white space characters (like U+3000) were bring removed or converted by the html conversion and simplified()
Simplified was replaced with trimmed(). Html conversion is avoided unless we are certain that the line has HTML.
Fixes #1840
This worked for my tests. The test file provided by the issue reporter now passes U+3000
The few subtitle files that I have with markup still pass with the markup being stripped.