Is the Unicode-only mode going to affect Windows console applications?
I've just finished a console project with PB 5.42, and I had to compile it in Ascii mode because I realized that in Unicode mode error messages sent to STDERR were posing problems under certain conditions. If I used the app directly from CMD, no problems whatsoever, but if I invoked it from a batch script, redirecting its outuput, then STDERR messages would end up in the (redirected) file with NUL chars inbetween each char. So, with Unicode compilation, this approach worked fine:
but if I created a batch file with such a line:
and invoked it thus:
Then the NUL inbetween chars would popup! Somehow, the problem only applied to ConsoleError().
I gather that this is because of the limited way Windows CMD handles Unicode:
CMD.exe only supports two character encodings Ascii and Unicode (CMD /A and CMD /U)
If you need full unicode support use PowerShell. There is still VERY limited support for unicode in the CMD shell, piping, redirection and most commands are still ANSI only. The only commands that work are DIR, FOR /F and TYPE, this allows reading and writing (UTF-16LE / BOM) files and filenames but not much else.
http://ss64.com/nt/chcp.html
In my case, after a few tests, I realized the problem was specific to PB's ConsoleError() function — the problem didn't show up with Print() or Print() funcs— so I ended up compiling it in Ascii mode.
With the passage to Unicode-only mode, how will PB handle such cases?
Are the console-related functionalities going to be adapted to handle such issues?
I know ... its a real bummer that Windows CMD still handles badly Unicode, especially when redirecting, and that not all of the CMD commands are Unicode compliants. Still, PowerShell is not a panacea for every situation -- and if you create a console app, chances are that people will invoke them from CMD.
I hope that coming updates of PB will address these issues, strengthening the Console library behaviour on Windows, making it true cross-platform — ie: allowing users not to worry about such issues, having one code for all OSs'.
Else, it might be a problem to continue to create console apps for Windows using PB — that is, without resorting to WinAPI libs, which would break cross-platformness of the app.