Skip to content
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: 708 captions multi-byte char fix #439

Merged
merged 3 commits into from
Oct 12, 2023
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
improve hexToString
  • Loading branch information
wseymour15 committed Oct 11, 2023
commit 56a3d9d4beec260c55259fac3b49687b94c29ac7
9 changes: 3 additions & 6 deletions lib/m2ts/caption-stream.js
Original file line number Diff line number Diff line change
Expand Up @@ -690,12 +690,9 @@ Cea708Stream.prototype.handleText = function(i, service, options) {

// Converts an array of bytes to a unicode hex string.
function toHexString(byteArray) {
const newArr = [];
byteArray.forEach((byte) => {
newArr.push(('0' + (byte & 0xFF).toString(16)).slice(-2));
});

return newArr.join('');
return byteArray.map((byte) => {
return ('0' + (byte & 0xFF).toString(16)).slice(-2);
}).join('');
};

if (isMultiByte) {
Expand Down