Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. Visual Basic
  4. Asc(string character) returns wrong value chinese win10 machine

Asc(string character) returns wrong value chinese win10 machine

Scheduled Pinned Locked Moved Visual Basic
helpquestion
21 Posts 6 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • R Ralf Meier

    May I ask why you don't read the data as Byte-Array instead of reading/converting them into a string ?

    U Offline
    U Offline
    User 13453209
    wrote on last edited by
    #11

    Yes, the reason is that I am using the FTDI DXXX library to read data from the USB chip. This passes the data as a string.

    R 1 Reply Last reply
    0
    • L Lost User

      That makes no sense, you cannot read 0 as 63 without some fairly bad code. You need to capture each character as it arrives and display it as a numeric value.

      U Offline
      U Offline
      User 13453209
      wrote on last edited by
      #12

      Well, the code could not be simpler. Just one line of code. The rest is done by the FTDI library routine that reads the USB data and passes it as a string. It all works fine in all systems we tested except Win10 running the chinese version. But thank you for taking the time to comment.

      1 Reply Last reply
      0
      • U User 13453209

        Yes, the reason is that I am using the FTDI DXXX library to read data from the USB chip. This passes the data as a string.

        R Offline
        R Offline
        Ralf Meier
        wrote on last edited by
        #13

        You should write something more about what you definately want to do. In the Moment I don't understand why you do it in that way ...

        U 1 Reply Last reply
        0
        • R Ralf Meier

          You should write something more about what you definately want to do. In the Moment I don't understand why you do it in that way ...

          U Offline
          U Offline
          User 13453209
          wrote on last edited by
          #14

          Well, it is quite simple and I did explain it before but let me try again. We have an instrument connected to the host PC. The software running on the PC needs to read EEPROM data held in the instrument. It sends a command to the instrument and the instrument responds by the sending the data. The software uses the FTDI DXXX library to read and write to the USB. The data is read byte by byte. The FTDI routine returns the data as a string. The software uses the Asc() function to get the value of each byte. It all works fine except in Win10 running the chinese version.

          R 1 Reply Last reply
          0
          • U User 13453209

            Well, it is quite simple and I did explain it before but let me try again. We have an instrument connected to the host PC. The software running on the PC needs to read EEPROM data held in the instrument. It sends a command to the instrument and the instrument responds by the sending the data. The software uses the FTDI DXXX library to read and write to the USB. The data is read byte by byte. The FTDI routine returns the data as a string. The software uses the Asc() function to get the value of each byte. It all works fine except in Win10 running the chinese version.

            R Offline
            R Offline
            Ralf Meier
            wrote on last edited by
            #15

            Of course ... I have read all you have written before. The thing what isn't clear for me is : why don't you read the data by the emulated COM-Port from the FTDI-Device ? I have had the same problem when I wanted to read the data from a RFID-Reader (and I solved it in that way).

            1 Reply Last reply
            0
            • U User 13453209

              Hello I am working with a piece of VB6 code that reads data from an instrument through the USB port. The instrument uses an FTID USB chip and the data is read by the host byte by byte from the USB bus using a driver supplied by FTID. Each data byte is returned as a string character and then converted using the function Asc(string). The problem is that on Windows 10 machines running chinese, the data returned is corrupted. I think this may have something to do with the longer (2 bytes per character instead of one) character coding used for chinese but I have not been able to understand the issue. Any suggestions?

              L Offline
              L Offline
              ledtech3
              wrote on last edited by
              #16

              Try using ASCW in stead of just plain ASC. ASC would be more for standard ASCII chars. Asc, AscW Functions[^]

              L 1 Reply Last reply
              0
              • L ledtech3

                Try using ASCW in stead of just plain ASC. ASC would be more for standard ASCII chars. Asc, AscW Functions[^]

                L Offline
                L Offline
                ledtech3
                wrote on last edited by
                #17

                Just curious why my answer got down voted when it was the first one and contained the information most other answers ?? -16 points not that I really care about points after all of these years here. Just Curious Why.

                Richard DeemingR 1 Reply Last reply
                0
                • L ledtech3

                  Just curious why my answer got down voted when it was the first one and contained the information most other answers ?? -16 points not that I really care about points after all of these years here. Just Curious Why.

                  Richard DeemingR Offline
                  Richard DeemingR Offline
                  Richard Deeming
                  wrote on last edited by
                  #18

                  ledtech3 wrote:

                  it was the first one

                  You do realise we can see the dates when the messages were posted, right? :doh: Your answer was posted on 27th October at 3:45. And it's exactly the same suggestion and link as my answer[^], which was posted 25th October at 17:22 - more than a day earlier than yours.


                  "These people looked deep within my soul and assigned me a number based on the order in which I joined." - Homer

                  "These people looked deep within my soul and assigned me a number based on the order in which I joined" - Homer

                  L 1 Reply Last reply
                  0
                  • Richard DeemingR Richard Deeming

                    ledtech3 wrote:

                    it was the first one

                    You do realise we can see the dates when the messages were posted, right? :doh: Your answer was posted on 27th October at 3:45. And it's exactly the same suggestion and link as my answer[^], which was posted 25th October at 17:22 - more than a day earlier than yours.


                    "These people looked deep within my soul and assigned me a number based on the order in which I joined." - Homer

                    L Offline
                    L Offline
                    ledtech3
                    wrote on last edited by
                    #19

                    Yeah but when I posted originally there were no other comments or questions showing up at the time. That's the reason I said that. Otherwise I would not have posted anything. I went thru the link from the email notification of the question so not sure if that was the reason or not that nothing else showed up. Either way I give up trying to "Help People" because of so many "Trolls" here.

                    Richard DeemingR 1 Reply Last reply
                    0
                    • L ledtech3

                      Yeah but when I posted originally there were no other comments or questions showing up at the time. That's the reason I said that. Otherwise I would not have posted anything. I went thru the link from the email notification of the question so not sure if that was the reason or not that nothing else showed up. Either way I give up trying to "Help People" because of so many "Trolls" here.

                      Richard DeemingR Offline
                      Richard DeemingR Offline
                      Richard Deeming
                      wrote on last edited by
                      #20

                      There were answers showing up in the forum more than 24 hours before you posted your answer. If you couldn't see them, then you need to report that as a bug: Bugs and Suggestions[^] You posted an answer that had already been posted more than a day previously, when the OP had already indicated that the answer did not help. It's hardly "trolling" for someone to down-vote your answer. :doh:


                      "These people looked deep within my soul and assigned me a number based on the order in which I joined." - Homer

                      "These people looked deep within my soul and assigned me a number based on the order in which I joined" - Homer

                      L 1 Reply Last reply
                      0
                      • Richard DeemingR Richard Deeming

                        There were answers showing up in the forum more than 24 hours before you posted your answer. If you couldn't see them, then you need to report that as a bug: Bugs and Suggestions[^] You posted an answer that had already been posted more than a day previously, when the OP had already indicated that the answer did not help. It's hardly "trolling" for someone to down-vote your answer. :doh:


                        "These people looked deep within my soul and assigned me a number based on the order in which I joined." - Homer

                        L Offline
                        L Offline
                        ledtech3
                        wrote on last edited by
                        #21

                        Well there are 2 Down votes now but at least I know why now and that's all I was asking. And I will report the bug. Thank you for your time.

                        1 Reply Last reply
                        0
                        Reply
                        • Reply as topic
                        Log in to reply
                        • Oldest to Newest
                        • Newest to Oldest
                        • Most Votes


                        • Login

                        • Don't have an account? Register

                        • Login or register to search.
                        • First post
                          Last post
                        0
                        • Categories
                        • Recent
                        • Tags
                        • Popular
                        • World
                        • Users
                        • Groups