How do I call the PowerShell CLI robustly, with respect to character encoding, input and output streams, quoting and escaping?

PowerShell CLI fundamentals: PowerShell editions: The CLI of the legacy, bundled-with-Windows Windows PowerShell edition is powershell.exe, whereas that of the cross-platform, install-on-demand PowerShell (Core) 7+ edition is pwsh.exe (just pwsh on Unix-like platforms). Interactive use: By default, unless code to execute is specified (via -Command (-c) or -File (-f, see below), an interactive session is … Read more

does (w)ifstream support different encodings

C++ supports character encodings by means of std::locale and the facet std::codecvt. The general idea is that a locale object describes the aspects of the system that might vary from culture to culture, (human) language to language. These aspects are broken down into facets, which are template arguments that define how localization-dependent objects (include I/O … Read more

How to determine encoding table of a text file

If you’re on Linux, try file -i filename.txt. $ file -i vol34.tex vol34.tex: text/x-tex; charset=us-ascii For reference, here is my environment: $ which file /usr/bin/file $ file –version file-5.09 magic file from /etc/magic:/usr/share/misc/magic Some file versions (e.g. file-5.04 on OS X/macOS) have slightly different command-line switches: $ file -I vol34.tex vol34.tex: text/x-tex; charset=us-ascii $ file … Read more