Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. language problem in C ..

language problem in C ..

Scheduled Pinned Locked Moved C / C++ / MFC
securityhelp
3 Posts 3 Posters 0 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.
  • G Offline
    G Offline
    gateway23
    wrote on last edited by
    #1

    hi , i made a simple application for encryption and decryption of a text file using c language. i want to know if a text file contains language symbols other than English , than how C language take care of it. Please also tell me if we can add other languages support in C language.

    S S 2 Replies Last reply
    0
    • G gateway23

      hi , i made a simple application for encryption and decryption of a text file using c language. i want to know if a text file contains language symbols other than English , than how C language take care of it. Please also tell me if we can add other languages support in C language.

      S Offline
      S Offline
      Stefan_Lang
      wrote on last edited by
      #2

      Check out http://en.wikipedia.org/wiki/Unicode[^]. You may want to use strings of unicode characters rather than just char Of course then you will also have to figure out and use encodings. Here's a good introduction on Unicode and encodings: http://www.joelonsoftware.com/articles/Unicode.html[^] I'm probably not the best person to ask about what libraries and system functions to use, but it shouldn't be too hard to google for. ;) I do know Visual Studio provides built-in support for unicode strings, it's right in the project options.

      1 Reply Last reply
      0
      • G gateway23

        hi , i made a simple application for encryption and decryption of a text file using c language. i want to know if a text file contains language symbols other than English , than how C language take care of it. Please also tell me if we can add other languages support in C language.

        S Offline
        S Offline
        Software_Developer
        wrote on last edited by
        #3

        IsTextUnicode function http://msdn.microsoft.com/en-us/library/windows/desktop/dd318672(v=vs.85).aspx[^] Unicode in Visual C++ http://msdn.microsoft.com/en-us/library/cc194799.aspx[^] Conversion between Unicode UTF-16 and UTF-8 in C++/Win32 http://msmvps.com/blogs/gdicanio/archive/2010/01/04/conversion-between-unicode-utf-16-and-utf-8-in-c-win32.aspx[^] Here is an example http://www.codersource.net/win32/win32-advanced/unicode-to-ascii-conversion.aspx[^]

        //Check if the file is UNICODE
        int IsUnicodeFile(char* szFileName)
        {
        FILE *fpUnicode;
        char l_szCharBuffer[80];

        //Open the file
        if((fpUnicode= fopen(szFileName,"r")) == NULL)
        return 0; //Unable to open file
        
        if(!feof(fpUnicode))
        {
            fread(l\_szCharBuffer,80,1,fpUnicode);
            fclose(fpUnicode);
            if(IsTextUnicode(l\_szCharBuffer,80,NULL))
            {
                return 2; //Text is Unicode
            }
           else
           {
               return 1; //Text is ASCII
           }
        }
        return 0; // Some error happened
        

        }

        1 Reply Last reply
        0
        Reply
        • Reply as topic
        Log in to reply
        • Oldest to Newest
        • Newest to Oldest
        • Most Votes


        • Login

        • Don't have an account? Register

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • World
        • Users
        • Groups