Skip to content

Fix Full-width spaces replaced by half-width spaces when importing subtitles #1840 - #1842

Merged
ddennedy merged 1 commit into
masterfrom
subtitle_whitespace
May 31, 2026
Merged

ddennedy merged 1 commit into
masterfrom
subtitle_whitespace

Conversation

@bmatherly

Copy link
Copy Markdown
Member

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.

…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.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 invoking QTextDocumentFragment::fromHtml().
  • Replace simplified() with trimmed() so internal whitespace (including U+3000) is preserved.

@ddennedy ddennedy added this to the 26.6 milestone May 31, 2026
@ddennedy
ddennedy merged commit 004e1d2 into master May 31, 2026
6 checks passed
@ddennedy
ddennedy deleted the subtitle_whitespace branch May 31, 2026 05:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Full-width spaces replaced by half-width spaces when importing subtitles

3 participants