Click here to Skip to main content
15,895,462 members
Home / Discussions / C#
   

C#

 
AnswerRe: Empty FileStream Pin
Luc Pattyn6-Jul-10 10:38
sitebuilderLuc Pattyn6-Jul-10 10:38 
GeneralRe: Empty FileStream Pin
Shaareable7-Jul-10 3:34
Shaareable7-Jul-10 3:34 
AnswerRe: Empty FileStream Pin
William Winner6-Jul-10 11:51
William Winner6-Jul-10 11:51 
GeneralRe: Empty FileStream Pin
Shaareable7-Jul-10 3:34
Shaareable7-Jul-10 3:34 
QuestionBinding treeview to an array Pin
LordZoster6-Jul-10 5:27
LordZoster6-Jul-10 5:27 
AnswerRe: Binding treeview to an array Pin
The Man from U.N.C.L.E.6-Jul-10 8:09
The Man from U.N.C.L.E.6-Jul-10 8:09 
GeneralRe: Binding treeview to an array Pin
LordZoster6-Jul-10 10:10
LordZoster6-Jul-10 10:10 
QuestionHow to convert an 8 bit based binary file inside a richtextbox Pin
Shaareable6-Jul-10 4:12
Shaareable6-Jul-10 4:12 
Greetings,

Here is an interesting question I hope.

In a nutshell, I am trying to convert to UTF8 an 8 bit encoded binary file and display into a RichTextBox.

I am learning to program against the Adobe PDF file format. The PDF Reference 1.7 tells at page 38 (2.2.1) that "PDF files are represented as sequences of 8-bit binary bytes".

In the hope of learning by looking at the source code of PDF documents, I created a very simple hello world text file in Notepad and printed it as PDF with all distiller options turned off. When you rename the test.pdf created as text.txt and view the result in Notepad you see an Ascii rendition of the 8 bit base code. You see enough readable material to understand what's going on.

Now when I load up that test.txt into a richtextbox, a part of the file (the bottom end, is missing). If I attempt to read the PDF directly using a binary reader I get the same results. So viewing the source in Notepad shows more than it does in a RichTextBox.

PDF experts recommends to convert to unicode first before displaying the source of a PDF.

So my question is how does one take a binary file, convert it to UTF8 and display it properly in a RichTextBox (w2k3r2sp2 with vs2010)?

And also, why is the richtextbox not displaying the bottom part of the file? Is there illegal characters in UTF8 or something to that effect?


I know its a lengthy question, and I appreciate your time. I spent all day yesterday in a rather futile effort at this...

Thank you!! Smile | :)

Antoine
AnswerRe: How to convert an 8 bit based binary file inside a richtextbox Pin
Richard MacCutchan6-Jul-10 5:01
mveRichard MacCutchan6-Jul-10 5:01 
GeneralRe: How to convert an 8 bit based binary file inside a richtextbox Pin
Shaareable6-Jul-10 5:31
Shaareable6-Jul-10 5:31 
GeneralRe: How to convert an 8 bit based binary file inside a richtextbox Pin
Richard MacCutchan6-Jul-10 6:40
mveRichard MacCutchan6-Jul-10 6:40 
GeneralRe: How to convert an 8 bit based binary file inside a richtextbox Pin
Shaareable6-Jul-10 7:44
Shaareable6-Jul-10 7:44 
GeneralRe: How to convert an 8 bit based binary file inside a richtextbox Pin
Richard MacCutchan6-Jul-10 10:15
mveRichard MacCutchan6-Jul-10 10:15 
GeneralRe: How to convert an 8 bit based binary file inside a richtextbox Pin
Shaareable6-Jul-10 10:21
Shaareable6-Jul-10 10:21 
Questionset html color code to forecolor Pin
prasadbuddhika6-Jul-10 2:34
prasadbuddhika6-Jul-10 2:34 
AnswerRe: set html color code to forecolor Pin
Luc Pattyn6-Jul-10 3:14
sitebuilderLuc Pattyn6-Jul-10 3:14 
AnswerRe: set html color code to forecolor Pin
Richard Blythe6-Jul-10 13:18
Richard Blythe6-Jul-10 13:18 
QuestionStored Procedure Question Pin
Hum Dum5-Jul-10 22:32
Hum Dum5-Jul-10 22:32 
AnswerRe: Stored Procedure Question Pin
Peace ON5-Jul-10 23:16
Peace ON5-Jul-10 23:16 
AnswerRe: Stored Procedure Question Pin
J4amieC6-Jul-10 0:37
J4amieC6-Jul-10 0:37 
GeneralRe: Stored Procedure Question Pin
ddecoy6-Jul-10 1:25
ddecoy6-Jul-10 1:25 
GeneralRe: Stored Procedure Question Pin
J4amieC6-Jul-10 2:03
J4amieC6-Jul-10 2:03 
GeneralRe: Stored Procedure Question Pin
ddecoy6-Jul-10 2:15
ddecoy6-Jul-10 2:15 
GeneralRe: Stored Procedure Question Pin
Dave Kreskowiak6-Jul-10 3:40
mveDave Kreskowiak6-Jul-10 3:40 
QuestionMessage Removed Pin
5-Jul-10 21:34
Helfdane5-Jul-10 21:34 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.