pepri / subtitles-editor

Visual Studio Code extension for editing SubRip Text (SRT) files with subtitles.
https://marketplace.visualstudio.com/items?itemName=pepri.subtitles-editor
58 stars 8 forks source link

Issue: Bug/Invalid character generated on translating .SRT files. #9

Closed fredsounds closed 3 years ago

fredsounds commented 3 years ago

Hi,

I’ve recently caught an issue of a strange (non UTF-8) character sometimes being generated in error upon translating .SRT files. Generated character in question: �

Attaching files of two test translations (original file and translated file for both) that reproduce this character/bug. Can you reproduce?

subtitles-editor-Issue-bug-char-03-26-2021.zip

Thank you, Fred

pepri commented 3 years ago

Hi, thanks for reporting the issue and providing good sample files.

I was not setting the encoding correctly when reading the response. This resulted in incorrect characters when the received chunk of bytes ended with incomplete code point. The behavior was not always reproducible as it depends on the timing how the bytes are received. I was able to reproduce the issue thanks to your second example file with many characters like this.

This issue is fixed in 1.1.4. Thanks!