've tried to add
QTextCodec :: setCodecForTr (QTextCodec :: codecForName ("GBK"));
and
QTextCodec * codec = QTextCodec :: codecForName ("System");
QTextCodec :: setCodecForLocale (codec);
QTextCodec :: setCodecForCStrings (codec);
QTextCodec :: setCodecForTr (codec);
had no effect
Another : ubuntu can be displayed properly txt Chinese
------ Solution --------------------------- -----------------
utf-8 it ?
------ Solution ---------------------------------------- ----
recommended to use UTF-8
------ Solution ---------------------------- ----------------
your system installed Zh_CN.UTF-8 yet ?
------ Solution ---------------------------------------- ----
locale look
------ Solution ------------------------------ --------------
confirm the next few lines of code is not placed in the wrong location , and write in the main function QApplication app; Try the next line .
------ Solution ---------------------------------------- ----
to use GBK, the system is now installed GBK, so you should be able
------ Solution ------------------- -------------------------
If you need to enter the Chinese QT :
Solution:
prerequisite is Ubuntu already installed Chinese support (ibus).
1, install IBus-qt4 Sudo apt-get install ibus-qt4
2, terminal input : gedit ~ /. profile,
in . profile add click Properties.
# IBus settings
export XMODIFIERS = "@ im = IBus"
export GTK_IM_MODULE = IBus
export QT_IM_MODULE = xim
export IBus &
export LC_CTYPE = zh_CN.utf8
Save and source ~ /. profile can.
Find out
------ Solution ---------------------------------- ----------
interface does not display Chinese , you can check whether the default font Qt support Chinese .
but can not display Chinese and qdebug okay .
------ Solution ---------------------------------------- ----
create a GUI project , just put a button in the upper input Chinese , do not set textcodec, run to see results .
------ eference --------------------------------------- < br>
UTF-8 also tried , or the same effect
------ eference ----------------------- ----------------
tried, no
------ eference ------------ ---------------------------
installed
------ eference ------- --------------------------------
found LC_ALL blank after revision
recompile phenomenon unchanged zh_CN.UTF-8 do not understand why some do not and some have quotes
saw
encoding or UTF-8, is not to be changed zh_CN.UTF-8? ? If yes, how to change it ? ?
------ eference ------------------------------------ ---
wooden people know how to solve this problem ah ? ? ? ?
------ eference --------------------------------------- < br>
confirm the next few lines of code is not placed in the wrong location , and write in the main function QApplication app; Try the next line .
location at which , I'm still a CPP file for each constructor are added , will not
------ eference ------------- --------------------------
how you plan to install GBK? I think Qt creator inside GBK encoding in which there is , ah
------ eference ------------------------- --------------
still ah heroes
------ eference ------------------------------- --------
font using WenQuanYi support Chinese , is following in ubuntu no problem when running function
is the Chinese not show
------ eference -------------------------------- -------
xin jian gong cheng ye bu xing, er qie yong le ni de fang fa lian shu ru ; fa dou mei you yong le! keng a!
------ eference --------------------- ------------------
I have tried in your way, but it doesn't work. ; what is the worse, my Chinese input
software can not work neither ......
------ eference --------------------- ------------------
artificial Sticky ......
------ eference --------------- ------------------------
was also mentioned before , use UTF-8 instead of UTF-8 No BOM source code encoding format.
------ eference --------------------------------------- < br> brothers, you do to solve this problem
I encountered the same problem with you
QT program can display Chinese form title
button inside Chinese is garbled have the solution you
------ eference ------------------------ ---------------
after some searching online , found to be caused by the lack of fontconfig , then re- configure:
. / configure-fontconfig
problem again , configure did not pass , suggesting Fontconfig does not pass , then enter / config.tests/x11/fontconfig directory, run make, find missing freetype associated header file, first ensure freetype development libraries have been installed :
sudo apt-get install libfreetype6-dev
installation freetype header files not found in the standard path , then
ln-s / usr/include/freetype2/freetype / / usr / include / freetype
here again make, or mistake, find missing fontconfig development libraries , so
sudo apt-get install libfontconfig1-dev
again make, no mistakes.
then enter the Qt source code directory , run again
. / configure-fontconfig
pass.
make
make install
complete.
没有评论:
发表评论