[fpc-pascal] Re: How to write text to the console?
Reinier Olislagers
reinierolislagers at gmail.com
Mon Jul 16 10:02:25 CEST 2012
On 16-7-2012 9:38, michael.vancanneyt-0Is9KJ9Sb0A at public.gmane.org wrote:
> On Mon, 16 Jul 2012, Reinier Olislagers wrote:
>> This works in FPC 2.7.1:
>> WriteConsole(GetStdHandle(STD_OUTPUT_HANDLE), at s[1],length(s),bw,nil);
>> ... but seems to be Windows-only.
>
> Indeed.
>
>>
>> What am I missing and what is the easiest cross-platform way to
>> output/accept UTF8 text to/from the console?
>
> There is no cross-platform way.
>
> On Unix, the (x/k)console is usually UTF-8 these days, so you don't need
> to do anything.
> You need to look at the various localization environment variables.
>
>> Should I set the console codepage back to the one in use before the
>> program ran? Should I also mess with SetConsoleCP and/or SetTextCodePage?
>
> These don't exist on non-windows ?
I have no idea, haven't looked yet. I was more or less looking at
anything that might have to do with code pages and plugging things into
the code.
Rather than trying to experiment further, I thought I'd ask.
More information about the fpc-pascal
mailing list