PDcurses:why can not work for Chinese characters?

75 Views Asked by At

I'm learning pdcurses on visual studio with GBK code, and it shows garbled when I use printw(), addstr() and addwstr() to print Chinese characters. I just tested the three functions, but I think all these printing functions won't work for Chinese. Maybe UTF-8 will work(I don't test that because visual studio can not fit UTF-8 well)?

1

There are 1 best solutions below

0
On

I know how to do. At first I compiled the pdcurses.dll with "WIDE=Y DLL=Y" option, as I thought Chinese characters are wide charcaters. In this case neither GBK nor UTF-8 will work for Chinese. Then I added "UTF8=Y" when making, the result was improved: when using UTF-8 to code, it can show right Chinese characters, though it puts a Chinese character, which is wide charcter and is the length of two English letters, in the size of one English letter, which makes it complete mess. So I just throw away "WIDE=Y" and "UTF8=Y" and then get the correct result. Really annoying.