Possible Encoding Issue Reading HTM File using .Net Streamreader
Posted
by Brian Boatright
on Stack Overflow
See other posts from Stack Overflow
or by Brian Boatright
Published on 2009-01-13T01:56:40Z
Indexed on
2010/03/16
0:09 UTC
Read the original article
Hit count: 344
I have an HTML file with a ® (copyright) and ™ (trademark) symbol in the text. These are just two among many other symbols. When I read the html file into a literal control it converts the symbols to something else.
The copyright symbol converts to ? (open box in ff) The trademark symbol converts to ™ (as expected)
If (System.IO.File.Exists(FullName)) Then
Dim StreamReader1 As New System.IO.StreamReader(FullName)
Contents.Text = StreamReader1.ReadToEnd()
StreamReader1.Close()
End If
Contents is a <asp:Literal runat="server" ID="Contents"></asp:Literal>
and it's the only control in the aspx page.
From some research I think this is related to the encoding but I don't know why it would change how to fix it.
The html file does not contain any Content-Type settings in the head section.
© Stack Overflow or respective owner