TobiasFaller/vscode-vt100-syntax-highlight

Text export with removed escape sequences not working

Closed this issue · 3 comments

Hello,

maybe I'm missing something, but the export with removed escape sequences doesn't seem to work.

If I export this short test file sample.vt100:

�[0KRunning with gitlab-runner 15.10.0 (456e3482)�[0;m
�[0K  on g3-docker-runner REjJuVfE, system ID: r_B7sV1SKOS2Ac�[0;m
section_start:1680546728:prepare_executor
�[0K�[0K�[36;1mPreparing the "docker" executor�[0;m�[0;m

as the text file sample.vt100.txt, I still get the same content including the escaoe sequences:

�[0KRunning with gitlab-runner 15.10.0 (456e3482)�[0;m
�[0K  on g3-docker-runner REjJuVfE, system ID: r_B7sV1SKOS2Ac�[0;m
section_start:1680546728:prepare_executor
�[0K�[0KPreparing the "docker" executor�[0;m�[0;m

What is going wrong or what am I doing wrong?

Otherwise I find your extension really useful. Nice work.

Regards,
accetto

Hey Accetto,

it seems that the "escape characters" (0x001B) have been replaced with the "replacement character" (0xFFFD) which is a questionmark in a black rectangle. Either GitHub has removed the escape characters from your text snipped or this has happened before.
If this happened before then this is often an issue with an encoding that does not support the escape character - for example ANSI.
This means that the escape character now is not an escape character anymore but instead a symbol.
To verify this can you please check if the colouring works inside the editor?
If not, then this might be an encoding issue either by selecting a wrong encoding in VS Code or by writing or converting the file with a wrong or unsupporting encoding.

See below the definitions of both unicode characters:

Best Regards,
Tobias

Hello Tobias,

thank you for your answer. Sorry for missing that GitHub has replaced the escape characters. This time I'll use screenshots to explain the problem.

The use case is about exporting CI log files from Gitlab.

This is the beginning of such a file as it is seen in the Gitlab itself:
vt100-issue-01

This is the raw view from the GitLab itself:
vt100-issue-02

This is the raw view saved as a UTF-8 text file as it is seen in Visual Studio Code:
vt100-issue-03

This is the hexadecimal view of the raw view:
vt100-issue-04

Now, what I've expected after VT100 export of the saved raw file (UTF-8) into text format was, that the result file will be just a plain text without any ESC sequences.

Hower, this is what I've got (as it is seen in VSCode):
vt100-issue-05

It's essentially the same file I was exporting.

This is its hexadecimal form:
vt100-issue-06

And this is how it looks in Notepad++:
vt100-issue-07

So it seems that VT100 Export does not remove the ESC sequences.

On the way I've also found that I can achieve what I need by copying the content of the VSCode preview of the saved raw view (the right hand panel):
vt100-issue-08

Maybe you can mention it in your documentation.

Regards,
accetto

Hello Accetto,

I've replicated the bug and am working on a fix.
Documenting a workaround for the bug should not be necessary once it's resolved.

Best Regards,
Tobias Faller