Handling special characters in C (UTF-8 encoding)

后端 未结 4 1473
天涯浪人
天涯浪人 2020-12-07 21:17

I\'m writing a small application in C that reads a simple text file and then outputs the lines one by one. The problem is that the text file contains special characters like

4条回答
  •  情深已故
    2020-12-07 22:11

    I don't know if it could help but if you're sure that the encodings of terminal and input file are the same, you can try to setlocale():

    #include 
    …
    setlocale(LC_CTYPE, "");
    

提交回复
热议问题