Menu

how to compile files with chinese character

2006-07-08
2012-09-26
  • Nobody/Anonymous

    Thanks

     
    • Nobody/Anonymous

      If the file is UTF-8 encoding it should compile. The Chinese character is treated as 2 ASCII characters. What error message are you getting? What does the code look like?

       
      • Anonymous

        Anonymous - 2008-04-19

        Hello
        I am using chinese character
        I have the same problem in compiling files with chinese character.
        L"abc" is fine.
        L"X" is "illegal character when X is a chinese word encoding in CP950.
        When I use VC, L"X" is ok to be compiled.
        However, it seems that L"X" is not find in Dev-cpp.
        Does that Dev-cpp ONLY recognize ascii ?
        What should I do if i want to has a chinese character string ?

         
        • cpns

          cpns - 2008-04-20

          You have resurrected a thread nearly two years old, and it may not be the same problem, the OP never responded to the answers given so we shall never know. If you feel that this thread is relevant, you should have started your own and included a link to this.

          Also as detailed in the "PLEASE READ BEFORE POSTING A QUESTION" thread, example code and teh resulting Compile Log text would be useful, especially in this case.

          If I had to guess, I would point out that L"X" is not a character, it is a string constant. You said: [quote] L"X" is "illegal character[...] [/quote], but L"X" is not a character, but L'X' is.

          The following:

          wchar_t b = L"X" ;

          is an error for example (invalid conversion from const wchar_t*' towchar_t'). Wheras:

          wchar_t b = L'X' ;

          is ok.

          However the first declaration fails also in VC++ 2008 (you never specified a version for VC++ or Dev-C++ - also required information). The following:

          wchar_t a = L'X' ;
          const wchar_t* c = L"X" ;
          

          compile ok. So unless you provide more information, your problem cannot be diagnosed or reproduced.

          Other than that, the previous answer apply.

          Clifford

           
    • Anonymous

      Anonymous - 2006-07-08

      Support for non-western (or even non US) character sets in console applications is poor and complicated. Console mode apps do not support Unicode so character sets requiring more than eight bits are not supported at all.

      You need to enable Unicode support to get it to work in console mde applications.

      It might help if you could eloborate a little more - your question (or rather lack of one) is rather terse.

      This reference may help: http://msdn.microsoft.com/library/default.asp?url=/library/en-us/intl/unicode_6bqr.asp

      I tried to find an equivalent page on the Chinese MSDN site (despite not reading Chinese!), but it looks like that only covers the latest .NET and Visual Studio 2005 technologies (Dev-C++ is stuck in the world of Win32 API programming). However since VC++ 2005 Express Edition is free, you might consider this as a possibly easier and better supported approach to Chinese applications. http://msdn2.microsoft.com/zh-cn/library/default.aspx

      Clifford

       

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.