Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. International
  3. Chinese
  4. 大家好,有没有办法将GBK编码用16进制显示出来?
Forum Updated to NodeBB v4.3 + New Features

大家好,有没有办法将GBK编码用16进制显示出来?

Scheduled Pinned Locked Moved Solved Chinese
2 Posts 1 Posters 1.2k 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.
  • H Offline
    H Offline
    Hcf134
    wrote on last edited by
    #1

    数据存在QString resource里面,我使用了如下的办法,最后只有中文才会转化成16进制,数字和字母并没有变成16进制。

    QByteArray Widget::_Private_Transform_Text_To_Hex(QString resource)
    {

    QTextCodec *EncodeMethod = QTextCodec::codecForName("GBK");
    
    return EncodeMethod->fromUnicode(resource);
    

    }
    是否有办法,望请赐教。

    1 Reply Last reply
    0
    • H Offline
      H Offline
      Hcf134
      wrote on last edited by
      #2

      大家好 ,我找到办法了,
      直接
      return EncodeMethod->fromUnicode(resource).toHex();

      就行了。。

      1 Reply Last reply
      1

      • Login

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