ZeroEffect Posted April 20, 2009 Posted April 20, 2009 I would like to display a file in a textbox or RichTextbox. I how load the file but the file is encoded in UTF8 format. and some characters do not show. Like chr(0) chr(1) chr(3). Things that are not really displayed. Is there away to display these characters? I know it would be more of a "place holder" but that is what I would like. Thanks ZeroEffect Quote If you can't find it, Build It. There is no place Like 127.0.0.1 also don't forget 1 + 1 = 10
ZeroEffect Posted April 20, 2009 Author Posted April 20, 2009 Ok I have found that null chr(0) cannot be displayed and when loading the file it stops at a null character. Any thoughts? Quote If you can't find it, Build It. There is no place Like 127.0.0.1 also don't forget 1 + 1 = 10
Administrators PlausiblyDamp Posted April 20, 2009 Administrators Posted April 20, 2009 How are you loading the data into the control in question? Quote Posting Guidelines FAQ Post Formatting Intellectuals solve problems; geniuses prevent them. -- Albert Einstein
ZeroEffect Posted April 27, 2009 Author Posted April 27, 2009 Thanks for the reply, this is how I am doing it. tbreadfromfile.Clear() Dim sr As New StreamReader(TextBox1.Text & ".dat", Encoding.UTF8) Dim data As Object = sr.ReadToEnd tbreadfromfile.Text = data sr.Close() Quote If you can't find it, Build It. There is no place Like 127.0.0.1 also don't forget 1 + 1 = 10
Administrators PlausiblyDamp Posted April 27, 2009 Administrators Posted April 27, 2009 What is generating the file? Are you sure it is UTF-8 if it is containing invalid characters? Just as an aside I would declare the variable data as a String rather than Object in your sample as ReadToEnd returns a string. Quote Posting Guidelines FAQ Post Formatting Intellectuals solve problems; geniuses prevent them. -- Albert Einstein
ZeroEffect Posted April 27, 2009 Author Posted April 27, 2009 I'll make that change. I am makeing the file too. Dim sw As New System.IO.StreamWriter(TextBox1.Text & ".dat", False, Encoding.UTF8) Dim k As Integer = 4 For i As Integer = 0 To holder.Length - 1 If i = k Then k = k + 5 sw.Write(Chr(0)) sw.Write(Chr(1)) sw.Write(Chr(2)) Else End If sw.Write(Hex(Asc(holder.Substring(i, 1)))) tbFinalOutput.AppendText(Hex(Asc(holder.Substring(i, 1)))) Next sw.Write(Chr(0)) sw.Close() Quote If you can't find it, Build It. There is no place Like 127.0.0.1 also don't forget 1 + 1 = 10
Administrators PlausiblyDamp Posted April 30, 2009 Administrators Posted April 30, 2009 Out of interest what kind of data are you storing in this file? Just curios as things like Chr(0), Chr(1) etc. are generally taken to have special meanings. Quote Posting Guidelines FAQ Post Formatting Intellectuals solve problems; geniuses prevent them. -- Albert Einstein
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.