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. reading unicode files

reading unicode files

Scheduled Pinned Locked Moved C / C++ / MFC
tutorialhelpquestion
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.
  • R Offline
    R Offline
    Rakesh5
    wrote on last edited by
    #1

    Hi all, I am making my application unicode supporting one. i have .txt,.doc files.. i want to upload the file in my application. I want to check what type of file before loading.. i am able to check whether ANSII or Unicode using BOM. I dont know how to check for UTf-8 and Unicode Big Endian type files. Its not accepting BOM condition. Does anyone know how to check that one? ------------------------------------------------ Code Snippet: This is how, i check for unicode encoded file: if (file.Read(&firstChar, sizeof(wchar_t)) > 0 && firstChar == (wchar_t)0xFEFF) { ...... } But, UTF-8 and unicode big endian type of files dont satisfy this condition. -------------------- Please guide me how to resolve this issue. Thanks, Rakesh.

    _ 1 Reply Last reply
    0
    • R Rakesh5

      Hi all, I am making my application unicode supporting one. i have .txt,.doc files.. i want to upload the file in my application. I want to check what type of file before loading.. i am able to check whether ANSII or Unicode using BOM. I dont know how to check for UTf-8 and Unicode Big Endian type files. Its not accepting BOM condition. Does anyone know how to check that one? ------------------------------------------------ Code Snippet: This is how, i check for unicode encoded file: if (file.Read(&firstChar, sizeof(wchar_t)) > 0 && firstChar == (wchar_t)0xFEFF) { ...... } But, UTF-8 and unicode big endian type of files dont satisfy this condition. -------------------- Please guide me how to resolve this issue. Thanks, Rakesh.

      _ Offline
      _ Offline
      _Superman_
      wrote on last edited by
      #2

      00 00 FE FF UTF-32, big-endian FF FE 00 00 UTF-32, little-endian FE FF UTF-16, big-endian FF FE UTF-16, little-endian EF BB BF UTF-8

      «_Superman_» I love work. It gives me something to do between weekends.

      K 1 Reply Last reply
      0
      • _ _Superman_

        00 00 FE FF UTF-32, big-endian FF FE 00 00 UTF-32, little-endian FE FF UTF-16, big-endian FF FE UTF-16, little-endian EF BB BF UTF-8

        «_Superman_» I love work. It gives me something to do between weekends.

        K Offline
        K Offline
        Karri Mohan
        wrote on last edited by
        #3

        Hi Superman, I tried exactly those methods you have mentioned in my code.. But to my surprise, it didnt work well.. Can you please guide me how to resolve this issue??

        Mohan

        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