Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. International
  3. Chinese
  4. QString的乱码问题
Forum Updated to NodeBB v4.3 + New Features

QString的乱码问题

Scheduled Pinned Locked Moved Chinese
2 Posts 2 Posters 5.7k 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.
  • X Offline
    X Offline
    xth21
    wrote on last edited by
    #1

    直接在代码中使用中文字符串,在Windows下无论用QCreator还是Visual Studio 都会出现中文字符串显示乱码问题

    原因是QString默认使用Ascii编码,要手动加入代码

    “QTextCodec::setCodecForCStrings(QTextCodec::codecForLocale)”才能解决问题

    为什么Qt不默认就是使用QTextCodec::codecForLocale呢?这对各个国家都没有冲突啊

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

      呵呵,如果这样做,Qt岂不是知道倒退了10多年? 你提到这个是10多年前的做法吧,直接导致同一个程序无法跨平台了。在utf8盛行的时代,而VC6/7/8/9/...,默认采用locale字符集,也算是与时代有些格格不入了

      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