0

I'm programming in VB.NET using Visual Studio 2008. I need to define a string literal containing the character "÷" equivalent to Chr(247). I understand that internally VS uses UTF-16 encoding, but when the source file is written to disk it contains the single byte value F7 for this character.

This source file is processed by another program that uses UTF-8 encoding by default, so it fails to interpret this character correctly, attempting to combine it with the following single-byte character. What encoding would correctly interpret the single byte F7 as the single character ÷?

Alternatively, is there a way of expressing a non-ASCII literal that uses only ASCII characters - like using some kind of escape sequence?

Nick
  • 1,490
  • 1
  • 14
  • 21

1 Answers1

3

well, i always thought that by default VS uses UTF-8 to save files. But ÷ is F7 in encoding ISO 8859-1. If this is not enough for you go here: how to change source file encoding in csharp project (visual studio / msbuild machine)?

Community
  • 1
  • 1
Andrey
  • 59,039
  • 12
  • 119
  • 163
  • If you aren't specifying encoding then the file is written in ASCII(7 bit data). For the full ASCII character set I use winndows-1252 encoding. – dbasnett May 19 '10 at 13:07
  • In the Western European locale, VS2008 uses the Windows code page to save files unless there are characters that won't fit! So many thanks, that was exactly the pointer I needed. – Nick May 19 '10 at 13:18
  • @dbasnett, no. i can be sure only about C# editor in VS, because i mainly use it. so, it saves in UTF-8, which is backward compatible with ASCII. – Andrey May 19 '10 at 13:28