sassoftware / vscode-sas-extension

This SAS Extension for Visual Studio Code provides support for the SAS language, including features such as SAS syntax highlighting, code completion, hover help, code folding, outline, SAS code snippets and run SAS code.
https://sassoftware.github.io/vscode-sas-extension/
Apache License 2.0
115 stars 47 forks source link

SAS.viewTable is not showing data with correct encoding #1132

Open henrik-forsell opened 1 month ago

henrik-forsell commented 1 month ago

Describe the bug Create a data set with that contains national characters, e.g. ÅÄÖ. Open the data set and it will not show those chars correctly.

Steps to reproduce *Create a data set with national chars; data work.myencoding; check_encoding="aa å, ae ä, oe ö"; run;

*Print values to the log, it will show it correctly; data null; set work.myencoding; put check_encoding; run;

*Print the data set to output, it will show it correctly; proc print data=work.myencoding; run;

Open the data set from the library and it will be showing the wrong characters.

Expected behavior The view table should show the national characters correctly.

Screenshots image

Environment (please complete the following information): Client OS: Windows 11 Extension version: v1.10.1 SAS version: 9.4

scnwwu commented 4 weeks ago

Currently the extension is using PROC JSON to dump the table content to JSON to be easily consumed by JS. It appears that PROC JSON can't handle the encoding well. Run below code will produce wrong characters into log.

filename out temp;
proc json nokeys out=out pretty; export work.myencoding; run;
data _null_; infile out; input; put _infile_; run;

I think we should take the OLE DB Provider (ADO) approach like EG.

henrik-forsell commented 4 weeks ago

As you guessed, there are odd chars in the log: image