Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. International
  3. Chinese
  4. 关于Qt读取MSSLQ中文资料乱码问题
QtWS25 Last Chance

关于Qt读取MSSLQ中文资料乱码问题

Scheduled Pinned Locked Moved Unsolved Chinese
1 Posts 1 Posters 879 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.
  • LeonSuL Offline
    LeonSuL Offline
    LeonSu
    wrote on last edited by
    #1

    所使用的作业系统:ubuntu 16.04
    在MSSQL上的伺服器定序:Chinese_Taiwan_Stroke_CI_AS
    目前所安裝的編碼為:C C.UTF-8 en_US.utf8 zh_CN.utf8 zh_TW zh_TW.big5 zh_TW.utf8
    UnixODBC与FreeTDS都是使用Ubuntu指令安装:
    sudo apt-get install unixodbc unixodbc-dev tdsodbc freetds-bin

    目前我在终端机下,使用isql的方法,可以显示正确的资讯,如下图
    0_1517378984955_004.png
    但是我使用Qt,QSqlQuery去抓取相同的栏位时,使用qDebug()无法显示出来。如下图。
    0_1517379286022_003.png
    但是其他非中文的栏位上,Qt是可以正常显示出来的。所以我可以排除Qt与资料库之间的连线问题。
    使用的语法如下:
    QSqlQuery query("SELECT MES_DESC FROM BAS_MES ", db);
    if(query.isActive())
    {
    while(query.next()){
    name = query.value(0).toByteArray().data();
    qDebug() << "Result = " << query.value(0).toString() << endl;

    }

    请大家帮帮忙,或是给点建议
    先谢谢!

    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