Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Problem on char on different windoes machine
Forum Updated to NodeBB v4.3 + New Features

Problem on char on different windoes machine

Scheduled Pinned Locked Moved General and Desktop
6 Posts 2 Posters 2.3k 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.
  • L Offline
    L Offline
    luca72
    wrote on last edited by
    #1

    hello i have a program where i write a QString like "this is my string"+char(001), in the computer where i compile(win xp) the program the char(001) is recognized but in another win pc(with xp) the char(001) is not recognized.

    Have you got some idea?

    Thanks

    Luca

    1 Reply Last reply
    0
    • A Offline
      A Offline
      andre
      wrote on last edited by
      #2

      Could you please post some actual code?

      Also, did you look into using QChar?

      1 Reply Last reply
      0
      • L Offline
        L Offline
        luca72
        wrote on last edited by
        #3

        yes i have try with qchar but with same result
        the code is very easy:
        @if (resume == true){
        frase_conferma = "PRIVMSG "
        + libreria
        +" :"
        +char(001)
        +"DCC RESUME "
        +nome
        +" "
        +porta
        +" "
        +QString::number(lunghezza_esistente)
        +char(001)
        +"\n";
        @

        thanks

        Luca

        Edit: make code more readable; Andre

        1 Reply Last reply
        0
        • A Offline
          A Offline
          andre
          wrote on last edited by
          #4

          But, what kind of thing is frase_conferma? Is that a QString, or something else?

          1 Reply Last reply
          0
          • L Offline
            L Offline
            luca72
            wrote on last edited by
            #5

            frase_conferma is a QString that i send with QTcpSocket in this way:
            socket.write(frase_conferma.toLatin1());//i have try also to ascii
            in linux windows and mac it works, but just in one windows machine i have no error but the char(001) is not send.
            Thanks

            Luca

            1 Reply Last reply
            0
            • A Offline
              A Offline
              andre
              wrote on last edited by
              #6

              How did you conclude that it did not work? Did you inspect the actual frase_conferma string before sending it? Just trying to help you pinpoint the precise point of failure here...

              Note that both toLatin1() and toAscii() may be dangerous to use, as you seem to use data in that string that comes from user input directly or indirectly. What happens if one or more of these strings contain characters from another character set?

              1 Reply Last reply
              0

              • Login

              • Login or register to search.
              • First post
                Last post
              0
              • Categories
              • Recent
              • Tags
              • Popular
              • Users
              • Groups
              • Search
              • Get Qt Extensions
              • Unsolved