Announcement

Collapse
No announcement yet.

Using ACSII > 127 in mono

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

  • Using ACSII > 127 in mono

    Hoping someone can point me in the right direction here!

    I've got a PI that uses character strings where some of command characters have ASCII values greater than 127. This is for sending data over a TCP connection.

    In vb.net on the Windows platform I can quite happily use a function like chr(147), but the same when run on linux seems to use a different encoding and gives me a different value.

    I've googled a fair bit to find a way round this and I think it was to do with using different encodings rather than rely on the built-in Char/chr functions present in vb.net.

    However I am at a brick wall so hopefully someone else has come across this and know of a workaround? (or the correct way to do this, assuming I am clearly getting it wrong!)
    Nicolai L

  • #2
    Maybe I am misreading this but can't you just select ISO-8859-1 instead of UTF-8 to get the extended ASCII set?

    Steve

    Comment


    • #3
      Originally posted by sesykes71 View Post
      Maybe I am misreading this but can't you just select ISO-8859-1 instead of UTF-8 to get the extended ASCII set?

      Steve
      Hi Steve

      I think you are probably very right, but I can't figure out how/where I do this?

      Any code snippets or guidance you may have would be much apprecaited.

      Nicolai
      Nicolai L

      Comment


      • #4
        I'm not very experienced in .NET but TCP only deals with sequences of bytes, it doesn't care about encodings. Protocols that sits on top of TCP (like HTTP) does deal with encodings though. If you're dealing directly with the BSD socket API (System.Net.Sockets.Socket) then you're looking for a byte data type, looks like VB.net has one.

        Comment


        • #5
          heppfs is right. Instead of sending chr(127) use a byte variable with the value 127.
          HS Pro 3.0 | Linux Ubuntu 16.04 x64 virtualized under Proxmox (KVM)
          Hardware: Z-NET - W800 Serial - Digi PortServer TS/8 and TS/16 serial to Ethernet - Insteon PLM - RFXCOM - X10 Wireless
          Plugins: HSTouch iOS and Android, RFXCOM, BlueIris, BLLock, BLDSC, BLRF, Insteon PLM (MNSandler), Device History, Ecobee, BLRing, Kodi, UltraWeatherWU3
          Second home: Zee S2 with Z-Wave, CT101 Z-Wave Thermostat, Aeotec Z-Wave microswitches, HSM200 occupancy sensor, Ecolink Z-Wave door sensors, STI Driveway Monitor interfaced to Zee S2 GPIO pins.

          Comment


          • #6
            Thanks guys will give it a go
            Nicolai L

            Comment

            Working...
            X