Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Setting "autoit.outputCodePage" seems to be not working at all 🤔 ?! #212

Closed
sven-seyfert opened this issue Feb 5, 2024 · 12 comments · Fixed by #217
Closed

Setting "autoit.outputCodePage" seems to be not working at all 🤔 ?! #212

sven-seyfert opened this issue Feb 5, 2024 · 12 comments · Fixed by #217

Comments

@sven-seyfert
Copy link

sven-seyfert commented Feb 5, 2024

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
Copy link
Author

sven-seyfert commented Feb 5, 2024

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
Copy link

vanowm commented Feb 12, 2024

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

@sven-seyfert
Copy link
Author

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
Copy link

Sunev commented May 5, 2024

runner.stdout.on('data', data => {
try {
const output = (config.isCodePage ? decode(data, config.outputCodePage) : data).toString();
aiOut.append(output);
} catch (er) {
console.error(er);
}
});
runner.stderr.on('data', data => {
try {
const output = (config.isCodePage ? decode(data, config.outputCodePage) : data).toString();
aiOut.append(output);
} catch (er) {
console.error(er);
}
});

As related lines above, a property named config.isCodePage was used, but which is not defined in package.json.
#217

@vanowm
Copy link

vanowm commented May 5, 2024

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

@Sunev
Copy link

Sunev commented May 5, 2024

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

@sven-seyfert
Copy link
Author

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:

  • replace "isCodePage" with "outputCodePage" in file extension.js (C:\Users\your-user-name-here\.vscode\extensions\damien.autoit-1.0.12\dist\extension.js)
  • restart VSCode
  • change the mentioned option by the VSCode settings

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
Copy link

vanowm commented May 7, 2024

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

@Sunev
Copy link

Sunev commented May 7, 2024

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
Copy link

vanowm commented May 7, 2024

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

@Sunev
Copy link

Sunev commented May 7, 2024

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

@Sunev
Copy link

Sunev commented May 10, 2024

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants