-
Notifications
You must be signed in to change notification settings - Fork 1.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix(WebVTT): Add support to , ‎ and ‏ #4920
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -940,8 +940,8 @@ shaka.text.VttTextParser = class { | |
} | ||
|
||
/** | ||
* This method converts the HTML entities &, <, >, ", and | ||
* ' in string to their corresponding characters. | ||
* This method converts the HTML entities &, <, >, ", ', | ||
* , ‎ and ‏ in string to their corresponding characters. | ||
* | ||
* @param {!string} input | ||
* @return {string} | ||
|
@@ -955,10 +955,13 @@ shaka.text.VttTextParser = class { | |
'>': '>', | ||
'"': '"', | ||
''': '\'', | ||
' ': ' ', | ||
'‎': '', | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Left-to-right mark in unicode is '\u{200e}' There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Done! |
||
'‏': '', | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Right-to-left mark in unicode is '\u{200f}' This could be important for layout of multi-lingual text in some RTL languages. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Done! |
||
}; | ||
|
||
// Used to match HTML entities and HTML characters. | ||
const reEscapedHtml = /&(?:amp|lt|gt|quot|#(0+)?39);/g; | ||
const reEscapedHtml = /&(?:amp|lt|gt|quot|#(0+)?39|nbsp|lrm|rlm);/g; | ||
const reHasEscapedHtml = RegExp(reEscapedHtml.source); | ||
// This check is an optimization, since replace always makes a copy | ||
if (input && reHasEscapedHtml.test(input)) { | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
To preserve the non-breaking space, use '\u{a0}'
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done!