Click here to Skip to main content
15,898,222 members
Home / Discussions / C#
   

C#

 
AnswerRe: Problem with timer event fireing Pin
sjembek30-Aug-06 5:06
sjembek30-Aug-06 5:06 
GeneralRe: Problem with timer event fireing Pin
Tom Wright30-Aug-06 5:20
Tom Wright30-Aug-06 5:20 
GeneralRe: Problem with timer event fireing Pin
sjembek30-Aug-06 5:49
sjembek30-Aug-06 5:49 
QuestionExtended characters and console redirection Pin
gewe30-Aug-06 3:57
gewe30-Aug-06 3:57 
AnswerRe: Extended characters and console redirection Pin
Dave Kreskowiak30-Aug-06 5:47
mveDave Kreskowiak30-Aug-06 5:47 
GeneralRe: Extended characters and console redirection Pin
gewe30-Aug-06 20:13
gewe30-Aug-06 20:13 
GeneralRe: Extended characters and console redirection Pin
lmoelleb30-Aug-06 22:21
lmoelleb30-Aug-06 22:21 
GeneralRe: Extended characters and console redirection Pin
gewe31-Aug-06 0:58
gewe31-Aug-06 0:58 
I created the following function, to try to convert console output to a string that can be displayed in a textbox.

private string ConsoleOutputToUnicode(string consoleOutput)<br />
{<br />
    byte[] bConsole = Console.OutputEncoding.GetBytes(consoleOutput);<br />
    byte[] bUnicode = UnicodeEncoding.Convert(Console.OutputEncoding, UnicodeEncoding.Unicode, bConsole);<br />
    return UnicodeEncoding.Unicode.GetString(bUnicode);<br />
}


I tried other encodings (Default, UTF7, UTF8, UTF32) with the same result, and ASCII resulting in a '?'. Same results with ASCIIEncoding instead of UnicodeEncoding.

The byte[] bConsole is filled with the proper ASCII values ('ë' translates into a byte with the value 137). In a console (or in a message reply box in this thread) type alt-137, and you will see an 'ë'.
In bUnicode I would expect two corresponding bytes with the values 235 and zero (for \x00EB), but I get the values 48 and 32 (so \x2030, which is the per mille sign). Why is that?

One thing I discovered is that typing alt-0137 in a console also gives a '‰'. It is almost like somewhere in the conversion process the leading zero is added.
GeneralRe: Extended characters and console redirection Pin
Dave Kreskowiak31-Aug-06 3:55
mveDave Kreskowiak31-Aug-06 3:55 
QuestionRounding numbers? Pin
Gavin Roberts30-Aug-06 3:44
Gavin Roberts30-Aug-06 3:44 
AnswerRe: Rounding numbers? Pin
Stefan Troschuetz30-Aug-06 3:54
Stefan Troschuetz30-Aug-06 3:54 
AnswerRe: Rounding numbers? Pin
mikone30-Aug-06 3:57
mikone30-Aug-06 3:57 
Questionconverting Matlab code ito C# Pin
signimage30-Aug-06 3:19
signimage30-Aug-06 3:19 
QuestionTrim a part of string away Pin
Support12330-Aug-06 3:14
Support12330-Aug-06 3:14 
AnswerRe: Trim a part of string away Pin
mikone30-Aug-06 3:20
mikone30-Aug-06 3:20 
GeneralRe: Trim a part of string away Pin
Support12330-Aug-06 3:29
Support12330-Aug-06 3:29 
AnswerRe: Trim a part of string away Pin
Dave Kreskowiak30-Aug-06 5:43
mveDave Kreskowiak30-Aug-06 5:43 
QuestionSerialization of a datatable using FileMode.Append Pin
John Baird30-Aug-06 3:13
John Baird30-Aug-06 3:13 
AnswerRe: Serialization of a datatable using FileMode.Append Pin
Robert Rohde30-Aug-06 5:00
Robert Rohde30-Aug-06 5:00 
GeneralRe: Serialization of a datatable using FileMode.Append Pin
John Baird30-Aug-06 9:12
John Baird30-Aug-06 9:12 
Questioncrestal report Pin
TAREQ F ABUZUHRI30-Aug-06 3:09
TAREQ F ABUZUHRI30-Aug-06 3:09 
Questionusing an eventhandler for a serialport Pin
Yustme30-Aug-06 2:52
Yustme30-Aug-06 2:52 
QuestionHow to insert data in a sql database from datagrid column Pin
choopie30-Aug-06 2:41
choopie30-Aug-06 2:41 
AnswerRe: How to insert data in a sql database from datagrid column Pin
mikone30-Aug-06 2:58
mikone30-Aug-06 2:58 
GeneralRe: How to insert data in a sql database from datagrid column Pin
choopie30-Aug-06 3:12
choopie30-Aug-06 3:12 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.