Encoding / Dos CP 437 / Visual Studio Code Extension / Export Function
Hello everyone,
I have an issue related to Visual Studio Code and its InterSystems extension when exporting routines from the database to the file system.
The code entered via the terminal editor is encoded in DOS code page 437, but when I export it to my file system, even if I set the file opening to DOS CP 437, the accented characters which are two bytes long cause problems.
Regardless of the test settings I've tried, the only one that retains meaning is CP 437, but I get an unnecessary character preceding my accented characters. In the context of opening in UTF-8, of course, each character is represented by a distinct character, but I lose the meaning as my accented characters are translated into a box character.
From what I understand, it's during the export that the encoding switches to UTF-8 and then it's too late for VSCode to do anything.
Does anyone have an idea for me to be able to edit the terminal editor routines correctly in Visual Studio Code?
Thank you, everyone.
Comments
The available documentation does not describe any setting in the VS Code InterSystems ObjectScript extension to preserve or control a DOS CP 437 character encoding during export. What it does state is that when you export code from the server, the extension copies files into your client-side workspace, and when it retrieves a document from the server to display or export it, it always uses LF line endings. There is no returned documentation here about export-time character-set selection or CP 437 support in the extension itself. [1][2]
What is documented for character translation is the Terminal application, not VS Code export. The Terminal application uses a network encoding and translates characters between its internal Unicode representation and the server. The default network encoding is UTF8. It supports UTF8, Windows, ISO, and EUC, and the server-side I/O translation must be consistent with the selected encoding as shown in $ZMODE. [3][4][5][6]
If you are entering code through the Terminal editor, the relevant documented action is to verify and align the Terminal network encoding and the server I/O translation ($ZMODE) so that the characters are translated correctly during terminal input/output. [3][4][5][6]
Note: The ObjectScript extension can import documents which encode line endings using either the LF or CRLF control character sequence. However, when the extension retrieves a document from the server to display it in VS Code or to export it into a client-side workspace, it always uses LF line endings. [1][2]
Important: If you decide to edit the code for your project on the client side, remain consistent. Do not make edits directly on the server as well, as doing so introduces considerable risks: client-side and server-side changes may conflict and result in lost work; server-side edits may not be tracked by your client-side source control solution. [1][2]
Because the returned documents do not provide a documented way to export routines from VS Code in DOS CP 437 or otherwise solve the specific accented-character corruption you described, I cannot give you a supported fix beyond checking Terminal encoding and $ZMODE consistency. [3][4][5][6][1][2]
Sources: