<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
</head>
<body smarttemplateinserted="true" text="#000000" bgcolor="#FFFFFF">
<div id="smartTemplate4-template"><br>
Hi,<br>
<br>
<p> </p>
<blockquote type="cite"><br>
I would definitely keep it that way. <br>
<br>
As I see it: Redirection or not should not matter, the system
should assume console output. <br>
Things like 'tee' make this concept dubious in any case: <br>
<br>
If you pipe output to a program, you don't expect the codepage
to change <br>
because of the redirection. </blockquote>
<p><br>
</p>
<p>In my projects, I set the output codepage to utf-8 when there
is a redirection<br>
</p>
It is platform agnostic, on identical inputs, it creates identical
output files on Linux and Windows. No one needs OEM files on Linux<br>
<br>
Best,<br>
Benito </div>
<br>
<div class="moz-cite-prefix">On 14.09.2020 14:51, Michael Van
Canneyt via fpc-pascal wrote:<br>
</div>
<blockquote type="cite"
cite="mid:alpine.DEB.2.21.2009141445490.17789@home"> <br>
<br>
On Mon, 14 Sep 2020, Tomas Hajny via fpc-pascal wrote: <br>
<br>
<blockquote type="cite">
<blockquote type="cite">opened: <br>
{$ifdef FPC_HAS_FEATURE_ANSISTRINGS} <br>
{ if no codepage is yet assigned then assign default ansi
codepage } <br>
TextRec(t).CodePage:=TranslatePlaceholderCP(TextRec(t).CodePage);
<br>
{$else FPC_HAS_FEATURE_ANSISTRINGS} <br>
<br>
I see no need to change this ? <br>
</blockquote>
<br>
Please, have a look at OpenStdIO (implemented at the end of
text.inc). That one changes the default codepage for Input,
Output and StdErr, but it doesn't care about possible
redirection and/or piping to some other application (not
necessarily written in FPC). That approach has both advantages
and disadvantages. The advantage is that "type
<redirected_file>" will give correct results on the
console. The disadvantage is that opening the redirected file
with any Win32 GUI application (let's say notepad.exe) will
result in garbage. I don't say that it is necessarily bad, but
it should be documented at least if we want to keep it that way.
<br>
</blockquote>
<br>
I would definitely keep it that way. <br>
<br>
As I see it: Redirection or not should not matter, the system
should assume console output. <br>
Things like 'tee' make this concept dubious in any case: <br>
<br>
If you pipe output to a program, you don't expect the codepage to
change <br>
because of the redirection. <br>
<br>
<br>
<blockquote type="cite">
<blockquote type="cite">I think it will differ since Crt is not
codepage aware. If you want it to <br>
work the same you'll have to make Crt codepage (and hence
unicode) aware. <br>
</blockquote>
<br>
As mentioned by me, Crt is currently more codepage aware than
the System unit output as far as output to console is concerned,
because Crt provides correct output even for shortstrings
(unlike the System unit). <br>
</blockquote>
<br>
I would need to check the details, but that sounds more like
accidental behaviour as opposed to intended behaviour to me :-) <br>
<br>
Michael. <br>
_______________________________________________ <br>
fpc-pascal maillist - <a class="moz-txt-link-abbreviated"
href="mailto:fpc-pascal@lists.freepascal.org">fpc-pascal@lists.freepascal.org</a>
<br>
<a class="moz-txt-link-freetext"
href="https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal">https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal</a>
<br>
</blockquote>
<br>
</body>
</html>