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
CODE PROJECT For Those Who Code
  • Home
  • Articles
  • FAQ
Community
  1. Home
  2. General Programming
  3. C#
  4. Ho to convert BLOB data to readable format

Ho to convert BLOB data to readable format

Scheduled Pinned Locked Moved C#
databasetutorialquestion
9 Posts 3 Posters 1 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.
  • N Offline
    N Offline
    narasingubhanu
    wrote on last edited by
    #1

    when i extracted BLOB data from database i can see like this in my word doc. how to convert it to readable format? o � 8 A+ ¬ 2 e � o � ¬ 2 e o � Cleveland, OH : & + & % / . H F 2 e ( o � �) � o ' �� � �� � @ Garamond - 2 2 � P o � Management Trainee ProgramZ 0 7 0 6 / S /

    OriginalGriffO A 2 Replies Last reply
    0
    • N narasingubhanu

      when i extracted BLOB data from database i can see like this in my word doc. how to convert it to readable format? o � 8 A+ ¬ 2 e � o � ¬ 2 e o � Cleveland, OH : & + & % / . H F 2 e ( o � �) � o ' �� � �� � @ Garamond - 2 2 � P o � Management Trainee ProgramZ 0 7 0 6 / S /

      OriginalGriffO Offline
      OriginalGriffO Offline
      OriginalGriff
      wrote on last edited by
      #2

      That depends on what it is! :laugh: If it's a Word document, then save it as a .DOC or .DOCX file, and get Word to open it. Presumably, when you saved the data you also saved a file name with it?

      Bad command or file name. Bad, bad command! Sit! Stay! Staaaay...

      "I have no idea what I did, but I'm taking full credit for it." - ThisOldTony
      "Common sense is so rare these days, it should be classified as a super power" - Random T-shirt

      N 1 Reply Last reply
      0
      • OriginalGriffO OriginalGriff

        That depends on what it is! :laugh: If it's a Word document, then save it as a .DOC or .DOCX file, and get Word to open it. Presumably, when you saved the data you also saved a file name with it?

        Bad command or file name. Bad, bad command! Sit! Stay! Staaaay...

        N Offline
        N Offline
        narasingubhanu
        wrote on last edited by
        #3

        Yes correct..i am saving it as .DOC when i am opening, it is asking conversion from "Encoding text" and when i select "Unicode" it is displaying like that

        OriginalGriffO 1 Reply Last reply
        0
        • N narasingubhanu

          Yes correct..i am saving it as .DOC when i am opening, it is asking conversion from "Encoding text" and when i select "Unicode" it is displaying like that

          OriginalGriffO Offline
          OriginalGriffO Offline
          OriginalGriff
          wrote on last edited by
          #4

          Try an experiment: upload a known-working file, and then save it as a different name. Compare the two and see if there are any differences. If there are, then you need to start by looking at how you are storing it and make sure that works first. But...DOC files aren't all Unicode - they can be a binary format, so doing an Unicode conversion is probably going to mess them up.

          Bad command or file name. Bad, bad command! Sit! Stay! Staaaay...

          "I have no idea what I did, but I'm taking full credit for it." - ThisOldTony
          "Common sense is so rare these days, it should be classified as a super power" - Random T-shirt

          1 Reply Last reply
          0
          • N narasingubhanu

            when i extracted BLOB data from database i can see like this in my word doc. how to convert it to readable format? o � 8 A+ ¬ 2 e � o � ¬ 2 e o � Cleveland, OH : & + & % / . H F 2 e ( o � �) � o ' �� � �� � @ Garamond - 2 2 � P o � Management Trainee ProgramZ 0 7 0 6 / S /

            A Offline
            A Offline
            Afzaal Ahmad Zeeshan
            wrote on last edited by
            #5

            Chances are that even inside your Word document and this web page there are many things that messed up the format, made it even worse. The binary object that you captured was indeed an array of bytes containing the data (I won't say it was initially a Word document) with a format to be taken care of while converting back to a valid file. That is why whenever you store a file in the image type (in SQL image is the binary data, not the image you know) you also store the file extension or MIME type (the thing you know as "application/json" etc.). They are used to convert that data back to files. When you copied the data, it was not of Word format, every file has its own structure that is followed when converting the bytes back to a representation of the file. Word was not able to convert it back to actual representation, in which case it showed you that broken format. Notice that most of the content, such as those characters were easily mapped and thus they were shown to you, but a few other stuff was not mapped. Simple as that. :-)

            The shit I complain about It's like there ain't a cloud in the sky and it's raining out - Eminem ~! Firewall !~

            N 1 Reply Last reply
            0
            • A Afzaal Ahmad Zeeshan

              Chances are that even inside your Word document and this web page there are many things that messed up the format, made it even worse. The binary object that you captured was indeed an array of bytes containing the data (I won't say it was initially a Word document) with a format to be taken care of while converting back to a valid file. That is why whenever you store a file in the image type (in SQL image is the binary data, not the image you know) you also store the file extension or MIME type (the thing you know as "application/json" etc.). They are used to convert that data back to files. When you copied the data, it was not of Word format, every file has its own structure that is followed when converting the bytes back to a representation of the file. Word was not able to convert it back to actual representation, in which case it showed you that broken format. Notice that most of the content, such as those characters were easily mapped and thus they were shown to you, but a few other stuff was not mapped. Simple as that. :-)

              The shit I complain about It's like there ain't a cloud in the sky and it's raining out - Eminem ~! Firewall !~

              N Offline
              N Offline
              narasingubhanu
              wrote on last edited by
              #6

              Ya correct..few content not mapped and some of the content mapped..tried dfferent options from Word ponit of view..but no luck

              A 1 Reply Last reply
              0
              • N narasingubhanu

                Ya correct..few content not mapped and some of the content mapped..tried dfferent options from Word ponit of view..but no luck

                A Offline
                A Offline
                Afzaal Ahmad Zeeshan
                wrote on last edited by
                #7

                Was the file initially of Word format (.doc or .docx; Rich Text Format is a separate case)?

                The shit I complain about It's like there ain't a cloud in the sky and it's raining out - Eminem ~! Firewall !~

                N 1 Reply Last reply
                0
                • A Afzaal Ahmad Zeeshan

                  Was the file initially of Word format (.doc or .docx; Rich Text Format is a separate case)?

                  The shit I complain about It's like there ain't a cloud in the sky and it's raining out - Eminem ~! Firewall !~

                  N Offline
                  N Offline
                  narasingubhanu
                  wrote on last edited by
                  #8

                  Yes..I am sure..its .DOC only..

                  A 1 Reply Last reply
                  0
                  • N narasingubhanu

                    Yes..I am sure..its .DOC only..

                    A Offline
                    A Offline
                    Afzaal Ahmad Zeeshan
                    wrote on last edited by
                    #9

                    I would recommend that you create the file using the stream (read the binary data using the SELECT) and then convert the stream (of binary data) to a file. In simple words, follow what OriginalGriff said above. :)

                    The shit I complain about It's like there ain't a cloud in the sky and it's raining out - Eminem ~! Firewall !~

                    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