- Feb
- 240
- 3
TEE looks like a very useful command! I tried it today for the first time, but did not get useful results. I'm wondering what I'm doing wrong.
After not having success with various .NET programs, I compiled a quick minimal case C# program which simply outputs a set of 100 lines ("This is a Test1", "This is a Test2", etc.). Here's the code:
The program runs fine by itself at the command line. But when I run it with TEE, I just get eight lines of far eastern characters.
Here's my command line:
Here's the output:
If I change the output encoding in the program to Ascii (by setting Console.OutputEncoding to System.Text.Encoding.Ascii), I get the same results.
Note: if I add /D to the TEE invocation, the date does show up properly, but the rest is still in far eastern characters:
What am I doing wrong?
After not having success with various .NET programs, I compiled a quick minimal case C# program which simply outputs a set of 100 lines ("This is a Test1", "This is a Test2", etc.). Here's the code:
Code:
using System;
using System.Threading;
namespace OutputTest {
class Program {
static void Main(string[] args) {
int i = 0;
Console.OutputEncoding = System.Text.Encoding.UTF8;
for (i = 0; i < 100; i++) {
Console.WriteLine("This is a test" + i);
Thread.Sleep(100);
}
}
}
}
The program runs fine by itself at the command line. But when I run it with TEE, I just get eight lines of far eastern characters.
Here's my command line:
Code:
OutputTest.exe | tee test.txt
Here's the output:
Code:
桔獩椠整瑳ര吊楨獩愠琠獥ㅴ桔獩椠整瑳ല
桔獩椠整瑳ള
桔獩椠整瑳ഴ
桔獩椠整瑳വ
桔獩椠整瑳ശ
桔獩椠整瑳ഷ
桔獩椠整瑳സ
桔獩椠整瑳ഹ
If I change the output encoding in the program to Ascii (by setting Console.OutputEncoding to System.Text.Encoding.Ascii), I get the same results.
Note: if I add /D to the TEE invocation, the date does show up properly, but the rest is still in far eastern characters:
Code:
2013/02/26 桔獩椠整瑳ര吊楨獩愠琠獥ㅴ桔獩椠整瑳ല
2013/02/26 桔獩椠整瑳ള
2013/02/26 桔獩椠整瑳ഴ
2013/02/26 桔獩椠整瑳വ
2013/02/26 桔獩椠整瑳ശ
2013/02/26 桔獩椠整瑳ഷ
2013/02/26 桔獩椠整瑳സ
2013/02/26 桔獩椠整瑳ഹ
What am I doing wrong?