loganch / AutoIt-VSCode

AutoIt Extension for Visual Studio Code
https://marketplace.visualstudio.com/items?itemName=Damien.autoit
MIT License
74 stars 25 forks source link

Setting "autoit.outputCodePage" seems to be not working at all πŸ€” ?! #212

Closed sven-seyfert closed 4 months ago

sven-seyfert commented 9 months ago

Hi πŸ‘‹ , first of all:

I really appreciate the VSCode extension and the work behind it, thanks folks πŸ‘ .

Problem:

The VSCode "OUTPUT" does not show the correct characters for "simple" german umlauts.

Reproducer script:

ConsoleWrite('This is a test of german umlauts. Umlauts: Γ€ ΓΆ ΓΌ ß. Emoji: πŸ˜€' & @CRLF)

Result: grafik

Settings:

If I adjust the codepage by setting autoit.outputCodePage to cp850, utf8 or windows1252 nothing changes in the output.

grafik

grafik

❓ The setting seems to be not working at all? Hint: The file encoding in my VSCode is set to UTF-8

grafik

❓ Do you guys see any issues that I am doing or can you reproduce this behavior?

Thanks for your time and keep staying healthy πŸ˜‡ .

Best regards Sven

sven-seyfert commented 9 months ago

Working work-around

Func _Print($sData)
    Local Const $iUtf8Flag = 4
    ConsoleWrite(BinaryToString(StringToBinary($sData & @LF, $iUtf8Flag)))
EndFunc

_Print('This is a test of german umlauts. Umlauts: Γ€ ΓΆ ΓΌ ß. Emoji: πŸ˜€' & @CRLF)
vanowm commented 9 months ago

Just out of curiosity, does it show correctly in SciTE?

sven-seyfert commented 9 months ago

Hi @vanowm , the german umlauts yes, but I cannot use emojis at all in SciTE. But I have to say, I didn't used SciTE since years - so maybe my bad in some lack of configuration πŸ€” .

Btw: The work-around _Print() function also has to be changed for SciTE to the ANSI flag (1) instead of UTF8 (4).

Sunev commented 6 months ago

https://github.com/loganch/AutoIt-VSCode/blob/1fc45786a0755426e9a9c4c9a26dfdb0760d6453/src/ai_commands.js#L670-L686 As related lines above, a property named config.isCodePage was used, but which is not defined in package.json. https://github.com/loganch/AutoIt-VSCode/pull/217

vanowm commented 6 months ago

Actually, this is a regression from ad6c3ebf5978eba74dbe37a7cf4bc51561d59f8b where centralized config was introduced. isCodePage was generated upon initialization, its purpose was to confirm that chosen outputCodePage is valid.

Sunev commented 6 months ago

Well, I didn't check commit history. It seems that isCodePage don't have a definition at this moment.

sven-seyfert commented 6 months ago

Hi and thank you @Sunev πŸ‘‹ . I tested your PR change #217 manually and it works. The setting Autoit: Output Code Page with the value windows1250 leads to correct german umlauts in the output panel πŸ‘Œ .

What I changed manually to test:

Without the replacement, the codepage option does not work at all. My research confirmed you assumption about "isCodePage" does not have a definition.

I hope the maintainer(s) will add this fix into the master branch, thanks πŸ˜€ .

Best regards Sven

vanowm commented 6 months ago

The only issue with this change is there is no check if outputCodePage value is valid or not, which might create errors (?)

Sunev commented 6 months ago

I think that won't be a big problem, because those developers who set .outputCodeapge should be responsible to make sure their inputs correct. And I guess they know what they are doing.

vanowm commented 6 months ago

True, however vscode syncs settings between computers, therefore on one system it might be valid, on another might not (hypothetically speaking)

Sunev commented 6 months ago

What about to set the default of .outputCodepage as ANSI? Thus most user won't even need to config this.

Sunev commented 6 months ago

I recently found that VSCode lets you turn off sync for individual settings with a right-click. So, syncing might not be a big deal.