PDA

View Full Version : Console output differs from instruction



DirectuX
04-06-2020, 17:48
Please, can someone confirm ?


uses "console"

printl Console_GetCP ' Outputs 850
printl " °C " ' Outputs ┬░C

WaitKey


ThinBasic 1.11.6.0 ALPHA
Font is "Consolas" and has support for the characters needed.
Changing font to "Deja vu" doesn't solve the issue.
Changing codePage to 1252 or 65001 doesn't solve the issue.

Petr Schreiber
04-06-2020, 19:35
Hi DirectuX,

the issue is in fact thinBASIC strings are now UTF8 encoded.

You can workaround it like:


uses "console"

printl Console_getCP ' Outputs 850
printl " " + chr$(248) + "C "

WaitKey


There is yet a mountain of work to make UTF8 work across various corners of thinBASIC.


Petr

DirectuX
04-06-2020, 22:09
Ah-ha!
Thanks Petr !

ErosOlmi
09-06-2020, 16:20
Forcing output code page to UTF8 can help.
Put the following at the beginning of the script


Console_SetOutputCP(%CP_UTF8)

DirectuX
09-06-2020, 21:20
Forcing output code page to UTF8 can help.
Put the following at the beginning of the script


Console_SetOutputCP(%CP_UTF8)




Changing codePage to 1252 or 65001 doesn't solve the issue.

Thanks Eros, it didn't work first because I was using Console_SetCP function instead.

Note: %CP_ built-in constants are not listed in the help file.