Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Special Interest Groups
  3. C++ Gurus
  4. Chinese character issues displayed in qt
Forum Updated to NodeBB v4.3 + New Features

Chinese character issues displayed in qt

Scheduled Pinned Locked Moved C++ Gurus
4 Posts 3 Posters 2.2k 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.
  • S Offline
    S Offline
    saravanavelu39
    wrote on last edited by
    #1

    Hi all,,

          I am using ubuntu14.04,,if i pass the chines character in button menas it displayed correct chinese character,,,and if i pass the chinese character in printer means in the receipt page chinese characters are not displayed properly,,Question mark characters are appeared in the receipt instead of chinese character,,Please give me some suggesstion,,Thanks,,,
    
    1 Reply Last reply
    0
    • IamSumitI Offline
      IamSumitI Offline
      IamSumit
      wrote on last edited by
      #2

      Hii
      Have you tried Qt linguist tool provided .

      Look
      "[qt-project.org] 4.8":http://qt-project.org/doc/qt-4.8/linguist-manual.html
      or
      "[qt-project.org] 5.0":http://qt-project.org/doc/qt-5/qtlinguist-index.html

      Be Cute

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

        Hi,

        Please show your code.

        What encoding do you use? How do you pass your string to the printer?

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

        1 Reply Last reply
        0
        • S Offline
          S Offline
          saravanavelu39
          wrote on last edited by
          #4

          Hi friends,

                     @    @QString ItemPushButton::name_check(QString str)
          

          {
          QTextCodec::setCodecForCStrings(QTextCodec::codecForName("UTF-8"));
          QRegExp [removed]"#([0-9]+);");
          QStringList list,list1;
          int pos = 0;
          int length;
          while((pos = expression.indexIn(str,pos))!=-1)
          {
          list << expression.cap(1);
          QString v;
          length = expression.matchedLength();
          v=str.mid(pos+1,length-1-1);
          QByteArray ba = v.toUtf8();
          QString str1 = QString(QChar(v.toInt()));
          list1 <<str1;
          pos += expression.matchedLength();
          }
          foreach (QString s, list) {
          str.replace(s,"");
          }
          str = str.replace("#","");
          str = str.replace(";","");

          foreach (QString s, list1) {
              str = str.append(s);
          }
          return str;
          

          }@

          This is my code,,In here i get the chinese character string,,, after that i pass this string to printer directly,,,In the receipt page other characters are comes correctly,,,the chinese character only the problem,,It prints the Question mark instead of chinese character,,Please give me a suggesstion,,,Thanks,

          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