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

mangled output windows commandline when using wstr and pipe #420

Open
thrive4 opened this issue Oct 3, 2023 · 0 comments
Open

mangled output windows commandline when using wstr and pipe #420

thrive4 opened this issue Oct 3, 2023 · 0 comments

Comments

@thrive4
Copy link

thrive4 commented Oct 3, 2023

Not sure to what degree this is os related, the commandline
aka console is using the standard US oem codepage with both
windows 7 and windows 10, however when using wstr to output
text in combination with ' | more' or ' > ' aka piping output
the output is mangled.

Tested on windows 7 and windows 10
fbc 1.09 and fbc 1.10.

Sample code to illustrate the issue:

dim help as string
help = "example: cmdsqlite.exe game.db select name from game where name like 'a%'"
select case command()
    case "-h", "-help", "--help", "-man"
        print wstr(help)
    case "-nowstr"
        print help
    case else
        print "invalid switch"
        end
end select

Compile above code (by example as wstr_issue.exe) and run:
Normal output
wstr_issue.exe -h

Mangled output
wstr_issue.exe -h | more
or
wstr_issue.exe -h > test.txt

Normal output
wstr_issue.exe -nowstr | more
wstr_issue.exe -nowstr > test.txt

In depth info commandline see:
https://devblogs.microsoft.com/commandline/windows-command-line-unicode-and-utf-8-output-text-buffer/
https://devblogs.microsoft.com/commandline/windows-command-line-introducing-the-windows-pseudo-console-conpty/

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

No branches or pull requests

1 participant