Page 1 of 1
How to initialize the console for ansi or ascii?
Posted: 26 Jan 2022 1:19
by VPExplorer
Hi,
What packages need to be included to do a
Code: Select all
console::init(stream::ansi) %(Is this syntax correct?)
?
I'm getting an undeclared identifier for stream::ansi, but I'm not sure where stream is located.
So far, I've got
open core, console, console_native, console_api
Re: How to initialize the console for ansi or ascii?
Posted: 26 Jan 2022 15:52
by Thomas Linder Puls
Notice the
However below.
You already have the necessary package included, the problem is that
ansi needs a codepage argument:
Code: Select all
interface stream
open core
domains
mode =
unicode;
ansi(codePage CP);
binary.
So an initialization could look like this:
Code: Select all
console::init(stream::ansi(codePageId::codePage_windows1251))
However a default console program has already initialized the console to
utf8 in the goal:
I think the best choice is
utf8 (old ASCII is a subset of utf8), but if you
must use another codepage you should write (with the codepage of your choice obviously):
Code: Select all
goal
console::run8(main::run, codePageId::codePage_windows1251).
Re: How to initialize the console for ansi or ascii?
Posted: 26 Jan 2022 21:06
by VPExplorer
Thank you, sir.
For most purposes UTF8 is the standard correct choice. But the samples I'm playing with won't require it. For this, I'll use ansi or ascii.
Re: How to initialize the console for ansi or ascii?
Posted: 31 Jan 2022 9:53
by Thomas Linder Puls
I will still think it is a bad choice to not to choose utf8 (plain ANSI/ASCII characters are a subset of utf8).
Re: How to initialize the console for ansi or ascii?
Posted: 31 Jan 2022 20:43
by VPExplorer
I know, thanks Thomas.
Thomas Linder Puls wrote: ↑31 Jan 2022 9:53
I will still think it is a bad choice to not to choose utf8 (plain ANSI/ASCII characters are a subset of utf8).