mschuchard / linter-ansible-linting

ansible-lint linter for pulsar

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Unreadable error messages in console by national code pages

VadimDor opened this issue · comments

Error messages in console are not readable at some locales. E.g. by russian locale on Windows we have following for "ansible-lint not found" error:
""ansible-lint"" �� ���� ����७��� ��� ���譥�
��������, �ᯮ��塞�� �ணࠬ��� ��� ������ 䠩���.
instead of
""ansible-lint"" не является внутренней или внешней
командой, исполняемой программой или пакетным файлом.

The solution were to decode the message first in module sb-exec file index.js:
reject(new Error((new TextDecoder('IBM866')).decode(data.stderr[0]).trim()));
istead of (e.g. line 41)
reject(new Error(data.stderr.join('').trim()));

The same probably is valid also for stdout (e.g. line 59 there).
To set valid encoding for TextDecoder() is either up to user and should be added to configuration of the package, or some package to guess encoding from buffer could be used (e.g. this one https://github.com/sonicdoe/detect-character-encoding )

Is your text encoding set correctly in your environment before launching Atom? Atom is supposed to inherit that from your environment or the relevant files, but I also have seen it behave erratically with non-Romanized text encoding.

I have done nothing extra to setup environment to launch Atom after installing the OS. So it is default behaviour on fresh non-Romanized OS Win 8.1

Actually I recall now the last time we saw this on linter-puppet-lint that this has nothing to do with Atom, but rather the text encoding that sb-exec is seeing.

I am going to call out for help.

This is now being handled in the responsible dependency steelbrain/exec#95