Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations biv343 on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Issues Writing HEX Chars in VB.Net 2003

Status
Not open for further replies.

ianwin

Programmer
Jul 5, 2005
44
US
I am attempting to write the character "ÿ" (chr(255)) in a text document using VB.Net 2003. I am using a streamwriter and the following code to get the character from the hex FF.

Chr(Convert.ToInt16("FF", 16))

When looking at this file in notepad the correct character is displayed, however when looking in a hex editor, two bytes have been written which are C3 and BF in hex. When looking at the local variables during runtime the characters look correct it is only when viewed through a hex editor the incorrect characters are displayed.

Has anyone got any ideas?

Ian
 
I solved this problem by using the binary reader and writer instead of the standard stream reader and writer. There must be some conversion done in the stream function which can affect writing certain chars.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top