Qt Forum

    • Login
    • Search
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Unsolved

    [SOLVED]toAscii function depreciation what to use instead?

    General and Desktop
    4
    5
    1627
    Loading More Posts
    • 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
      mahmoud899 last edited by

      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 Reply Quote 0
      • JKSH
        JKSH Moderators last edited by

        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 Reply Quote 0
        • M
          MuldeR last edited by

          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 Reply Quote 0
          • D
            dbzhang800 last edited by

            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 Reply Quote 0
            • M
              mahmoud899 last edited by

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

              Mahmoud Ramy

              1 Reply Last reply Reply Quote 0
              • First post
                Last post