Announcement

Collapse
No announcement yet.

My C# is pretty flat

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • My C# is pretty flat

    C# is not my native language on PCs (Give me Delphi any day), but I need to use it to produce code to talk to my display, in order to acheive the end result.

    I have been chasing myself around in a circle going mad. I appears that C# wants to use Unicode (A double byte character set) and I can't figure out how to disable this 'feature' or bypass it.

    For example, the Delphi char, byte, whatever, chr(130) appears to be impossible to create in C#, if I use Convert.ToChar(130) I end up with a string of length 1(!?) which is actually x'C282' rather than the expected x'82'.

    The are lots of other examples of this behaviour, but, in short, how do I fix it?

  • #2


    ...Answering my own questions again...

    You need to specify an encoding of System.Text.Encoding.GetEncoding(1252); before you open the Coms port.


    ...Actually, it's sillier than that, I can now see my code converting into Unicode and back again... Not very efficient....

    Comment

    Working...
    X