The fb run time system communicates with the terminal using escape sequences. The garbage seen are unhandled escape sequences - looks like cursor position information. The escape sequences allow features like mouse position, window size, etc to be communicated to fb rtlib from the terminal.
Either getwchar() interrupts / disables the escape sequence handle and/or fb rtlib doesn't know to recover from it.
I think If you read all the bytes from INKEY, you should get the sequence of UTF-8 characters. But then would need to buffer the bytes and convert the UTF8 bytes to a UTF32 for wstrings.
If you don't need fb's colour, locate, width, etc, statements:
Magic fb code to disable escape sequences:
Code: Select all
extern as long __fb_enable_vt100_escapes alias _
"__fb_enable_vt100_escapes"
dim shared as long __fb_enable_vt100_escapes = 0