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. [SOLVED]toAscii function depreciation what to use instead?

[SOLVED]toAscii function depreciation what to use instead?

Scheduled Pinned Locked Moved General and Desktop
5 Posts 4 Posters 1.9k Views
  • 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.
  • M Offline
    M Offline
    mahmoud899
    wrote on last edited by
    #1

    Hello, I want to write a small program, the program takes a STRING and converts it to ASCII code. The problem is that the toAscii function depreciated. I would like to know if there is another function that takes a STRING and converts it to ASCII.

    Thank You

    Mahmoud Ramy

    1 Reply Last reply
    0
    • JKSHJ Offline
      JKSHJ Offline
      JKSH
      Moderators
      wrote on last edited by
      #2

      Hi,

      Use QString::toLatin1()

      Qt Doc Search for browsers: forum.qt.io/topic/35616/web-browser-extension-for-improved-doc-searches

      1 Reply Last reply
      0
      • M Offline
        M Offline
        MuldeR
        wrote on last edited by
        #3

        Consider using toUtf8() so Unicode characters won't get destroyed!

        Note: The ASCII characters (0x00 to 0x7F) are bit-identical to ASCII in UTF-8.

        My OpenSource software at: http://muldersoft.com/

        Qt v4.8.6 MSVC 2013, static/shared: http://goo.gl/BXqhrS

        Go visit the coop: http://youtu.be/Jay...

        1 Reply Last reply
        0
        • D Offline
          D Offline
          dbzhang800
          wrote on last edited by
          #4

          Hi, if you characters are really ASCII characters, any ASCII-compatible encode can be used, such as Latin1/Latin2/.../Latin11/Latin13/.../Latin15/Utf8/GB18030/...

          All of these conversion can be done using QTextCodec::fromUnicode().

          QString has provided the convenient QString::toLatin1()/QString::toUtf8(), depending on the your local, QString::toLacal8Bit() can be used too.

          1 Reply Last reply
          0
          • M Offline
            M Offline
            mahmoud899
            wrote on last edited by
            #5

            Thank you for your replies, they helped me solve the problem. Thanks again

            Mahmoud Ramy

            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