Euphoria Ticket #1018: getc, gets, get_keys on windows interpreter can't reiceve binary info from std input

As exposed on forum: https://openeuphoria.org/forum/136915.wc?last_id=136932

Interpreter for windows can't to receive info from binary stdinput. When a control-z character is received, the character is changed from 26 to -1 and the stream breaks. Any try to get more characters from stdinput returns allways -1, so the information received after that character is lost.

This problem limitate the use of windows interpreter for cgi-bin on windows, because web forms can't to receive binary files.

Such behavior is the expected for real files on disk or for keyboard input emulating a file, but not for other uses.

Note that on Eu3.1, the character 26 is exchanged to -1, but the stream don't break, so the programmer can work around the problem. Simply search -1 and replace to 26 on the data sequence.

Proposal:

1 - At least for the next stable release, we need to go back to Eu 3.1 behavior. Because is consistent with historic DOS and Windows console apps, and in the particular case for cgi-bin use there is a workaround option.

2 - Consider in future versions that std input may to act as a "binary file", the same as on linux. Java language, do it such way, and only delete the ctrl-z character when appear at the end of the stream and dont received more info later. Any ctrl-z into the middle stream pass to the app without any change.

The developers must to decide wich one is better to be the default behavior in the long term, may be to stablish "binary" as default or may be keep the current "text mode" and stablish a way to open std input as binary when required. May be an optional flag? may be close(0) and open(0, "b")?

Marco Achury

Details

Type: Bug Report Severity: Major Category: Library Routine
Assigned To: ghaberek Status: New Reported Release: 4.1.0 development
Fixed in SVN #: View VCS: none Milestone: 4.1.0

Search



Quick Links

User menu

Not signed in.

Misc Menu