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
117 stars 47 forks source link

Specific DBCS character can't be displayed in Result window while it works fine in Code Editor or Output window #1116

Closed ylwsas closed 2 months ago

ylwsas commented 2 months ago

Describe the bug Some character displayed as BOX in result window after SAS code execution, but the same char can be displayed well in Code Editor or Output window (Log).

Steps to reproduce

  1. Start VSCode and run following SAS attached "simple.sas".
    simple.sas.txt

  2. Check the 4th character display in Result window on the right, compare it in the source code editor and output window(Log).

Expected behavior Display the char as expected.

Screenshots See simple.png attached.

simple

Environment (please complete the following information): Client OS: [e.g. Windows 11] Extension version: v1.10.1 SAS version: [e.g. Viya [2024.07]]

Additional context Add any other context about the problem here.

scnwwu commented 2 months ago

VS Code simply displays the HTML file like a browser. If I export and open the HTML file (for example run and exported from EG or Studio) in a browser, it displays the same. It appears that the default font family provided by ODS doesn't display the character well. User need to specify a font family that can display it well. For example, change the print statement to be

proc print data=a style(data)={fontfamily="SimSun"};run;

I don't think anything can be done in the SAS extension side. The HTML file need to be made that can be displayed well on its own.

ylwsas commented 2 months ago

This can be a potential bigger impact to SAS output report, by default, the output data already with font family specified.

font-family: MYingHei_18030_C-Medium, MYingHei_18030_C-Medium, Helvetica, Helv, sans-serif;

So in SAS Base, there is not a problem. but for third party render like Browser, it has to apply the style something like:

style=" font-family: SimSun;"

The key problem is SAS font MYingHei_18030 (中易宋体 18030) has limitation, it's worse than the OS default SimSun. Maybe SAS should proivde SimSun to the font family by default. This may be a SAS font mapping problem which need to be enhanced.