Click here to Skip to main content
15,893,508 members
Home / Discussions / C#
   

C#

 
AnswerRe: Hi All Pin
Richard Andrew x6424-Oct-12 16:12
professionalRichard Andrew x6424-Oct-12 16:12 
AnswerRe: Hi All Pin
OriginalGriff24-Oct-12 19:39
mveOriginalGriff24-Oct-12 19:39 
AnswerRe: Hi All Pin
V.24-Oct-12 21:12
professionalV.24-Oct-12 21:12 
QuestionOne 8-Bit Byte Across The Serial Port Pin
C-P-User-324-Oct-12 12:58
C-P-User-324-Oct-12 12:58 
AnswerRe: One 8-Bit Byte Across The Serial Port Pin
Dave Kreskowiak24-Oct-12 13:35
mveDave Kreskowiak24-Oct-12 13:35 
GeneralRe: One 8-Bit Byte Across The Serial Port Pin
C-P-User-325-Oct-12 11:51
C-P-User-325-Oct-12 11:51 
GeneralRe: One 8-Bit Byte Across The Serial Port Pin
Dave Kreskowiak26-Oct-12 2:26
mveDave Kreskowiak26-Oct-12 2:26 
GeneralRe: One 8-Bit Byte Across The Serial Port Pin
C-P-User-326-Oct-12 6:23
C-P-User-326-Oct-12 6:23 
Thanks Dave,

I clicked on the link and arrived on this page...

http://msdn.microsoft.com/en-us/library/y2sxhat8.aspx

... Which has the title, "...SerialPort.Write Method..." I find this sentence...

"...By default, SerialPort uses ASCIIEncoding to encode the characters. ASCIIEncoding encodes all characters greater than 127 as (char)63 or '?'.

That is absolutely not what I want.

The next sentence after that says...

"...To support additional characters in that range, set Encoding to UTF8Encoding, UTF32Encoding, or UnicodeEncoding...."

I made the guess that I did *NOT* want UTF32Encoding, or UnicodeEncoding, which left the one choice of UTF8Encoding.

I clicked on that link and came to this page....

http://msdn.microsoft.com/en-us/library/system.text.utf8encoding.aspx

...which had the title, "UTF8Encoding Class".

That class has 3 constructors, 13 properties, and 33 methods.

The 11th of those 13 properties is, "IsSingleByte", which led me to believe that that might be of interest to me. The description of that property read as follows...

"...When overridden in a derived class, gets a value indicating whether the current encoding uses single-byte code points. (Inherited from Encoding.)..."

The word "Encoding" was within a href link as well, so I had to choose which to view first. The "IsSingleByte" looked most likely, so I clicked on that link.

That click to me to this page...

http://msdn.microsoft.com/en-us/library/system.text.encoding.issinglebyte.aspx

Which had the title, "...Encoding.IsSingleByte Property..."

This seemed to be a property with a boolean [True|False] value. An example is present on that web page. The results are all "True" and "False" values, so this may or may not be relevant to my interests.

On that page, I saw this blurb...


========================================CLIP========================================
Caution

You should be careful in what your application does with the value for IsSingleByte. An assumption of how an Encoding will proceed may still be wrong. For example, Windows-1252 has a value of true for Encoding.IsSingleByte, but Encoding.GetMaxByteCount(1) returns 2. This is because the method considers potential leftover surrogates from a previous decoder operation.



========================================CLIP========================================


...so I just sat there and wondered what thoughts were in their mind when they wrote that.

If I knew what "Windows-1252" was I might understand more (as of this writing, I'm still using Win'7, hoping the boss will buy me Win'8).

After that, I returned to the previous page from which this link was acquired to look at the "Encoding" link.

I arrived at this page...

http://msdn.microsoft.com/en-us/library/system.text.encoding.aspx

...which had the title, "...Encoding Class..."

There were 2 constructors, 21 properties, and 33 methods.

Of the 21 properties, the 15th was "IsSingleByte", the same link I had earlier clicked, so I didn't want to follow a circular paradigm.

The 19th property was "UTF8" with the description "Gets an encoding for the UTF-8 format" so I guessed that that might be it. I clicked and arrived at this page...

http://msdn.microsoft.com/en-us/library/system.text.encoding.utf8.aspx

...Which had the title, "...Encoding.UTF8 Property..."



Where I read, "...This property returns a UTF8Encoding object that encodes Unicode characters into a sequence of one to four bytes per character..."

That is, again, exactly and precisely what I **DO**NOT** want. I want to send out UN-encoded bytes; just regular 8 bit values.

So, I am encountering circular logic with no end and no answer. I could really use some advice on how to send one byte (any one of 256 possible values) by itself, without encoding extra bytes to go along with it, out the serial port.

Does C# provide such a capability ?
GeneralRe: One 8-Bit Byte Across The Serial Port Pin
Dave Kreskowiak26-Oct-12 8:47
mveDave Kreskowiak26-Oct-12 8:47 
AnswerRe: One 8-Bit Byte Across The Serial Port Pin
Gerry Schmitz24-Oct-12 15:19
mveGerry Schmitz24-Oct-12 15:19 
GeneralRe: One 8-Bit Byte Across The Serial Port Pin
C-P-User-330-Oct-12 8:32
C-P-User-330-Oct-12 8:32 
GeneralRe: One 8-Bit Byte Across The Serial Port Pin
Gerry Schmitz30-Oct-12 11:01
mveGerry Schmitz30-Oct-12 11:01 
QuestionC# exe app Pin
Michael Kurdík24-Oct-12 10:10
Michael Kurdík24-Oct-12 10:10 
AnswerRe: C# exe app Pin
Pete O'Hanlon24-Oct-12 10:49
mvePete O'Hanlon24-Oct-12 10:49 
AnswerRe: C# exe app Pin
Abhinav S24-Oct-12 19:58
Abhinav S24-Oct-12 19:58 
QuestionWinforms or WPF Pin
Orjan Westin24-Oct-12 0:09
professionalOrjan Westin24-Oct-12 0:09 
AnswerRe: Winforms or WPF Pin
BobJanova24-Oct-12 0:52
BobJanova24-Oct-12 0:52 
AnswerRe: Winforms or WPF Pin
Pete O'Hanlon24-Oct-12 1:11
mvePete O'Hanlon24-Oct-12 1:11 
GeneralRe: Winforms or WPF Pin
Orjan Westin25-Oct-12 3:25
professionalOrjan Westin25-Oct-12 3:25 
AnswerRe: Winforms or WPF Pin
Eddy Vluggen24-Oct-12 1:18
professionalEddy Vluggen24-Oct-12 1:18 
AnswerRe: Winforms or WPF Pin
V.24-Oct-12 2:42
professionalV.24-Oct-12 2:42 
AnswerRe: Winforms or WPF Pin
Keith Barrow24-Oct-12 6:49
professionalKeith Barrow24-Oct-12 6:49 
AnswerRe: Winforms or WPF Pin
Gerry Schmitz24-Oct-12 15:37
mveGerry Schmitz24-Oct-12 15:37 
AnswerRe: Winforms or WPF Pin
Bernhard Hiller26-Oct-12 0:34
Bernhard Hiller26-Oct-12 0:34 
Questioncreate a node with color in c# Pin
mahendiran bala23-Oct-12 23:43
mahendiran bala23-Oct-12 23:43 

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.