Closed StarpTech closed 5 years ago
Thanks for opening this! Two thoughts: paths seem like a doable, albeit tedious, fix. Symbols and colours are harder, as I don’t have access to a Windows computer. could you help work on this?
Hi @wooorm,
I spend little time on it and come to the following conclusion.
On windows, the common codepage is 437
(USA) or 850
(Europe) and it doesn't support the icons. Therefore the package which choose the correct one is not unifiedjs but vfile-reporter. When I manually change the codepage to 65001
(utf8) the icons represent the state in vfile-reporter. The reason is well explained in pinojs and we should add such a help section as well. Finally, due to the nodejs limitation there is only one good solution
vfile-reporter
always use utf8 charactersEven with codepage 437
or 850
the fallback icons “×” (U+00D7) looks wrong and this points to the node.js limitation.
On Windows, if the file descriptor is connected to the console (e.g. fd == 1 or stdout) a string containing non-ASCII characters will not be rendered properly by default, regardless of the encoding used. It is possible to configure the console to render UTF-8 properly by changing the active codepage with the chcp 65001 command. See the chcp docs for more details.
Reference: https://nodejs.org/api/fs.html#fs_fs_write_fd_string_position_encoding_callback
Hmm, could we alternatively use vfile-reporter-json
in most cases, and parse that, instead of rewriting everything for both windows and non-windows?
It looks like it is much easier to fix. The tap output doesn't represent the real value. When I replace all figures with windows compatible symbols it works but the package vfile-reporter-pretty
rely on log-symbols
which use utf8 symbols when the CI env variable is set. In the test the env is overwritten manually. The next issue is absolute path handling of the vfile-reporter-pretty
reporter on windows.
I created https://github.com/unifiedjs/unified-engine/pull/36 which illustrate my way.
Feel free to work on that PR as well because I won't have time to fix all issues.
Paths, Symbols, Colors aren't tested for windows.