3

I am writing a C# script that instruments some VB6 code.

I need to output the generated code using the same encoding as VB6 to avoid losing character data. Right now it keeps changing Latin characters, like é, to null characters.

Notepad++ guesses that VB6 files are ANSCII by default, but since they don't have a BOM that's just an educated guess. I have tried encoding with ANSCII and it still loses character data.

Any ideas?

John Smith
  • 61
  • 3
  • Try windows-1252 (see https://stackoverflow.com/questions/2049272/what-is-the-default-vb6-charset and https://en.wikipedia.org/wiki/Windows-1252). – rskar Aug 29 '19 at 21:50
  • If windows-1252 is not it try ISO-88591. I found that text files that were being output from SQL data by our code were encoded this way where we had not specified any file encoding. https://en.wikipedia.org/wiki/ISO/IEC_8859-1 – jac Aug 30 '19 at 00:18
  • Interesting. I thought this would be answered clearly by the documentation, but [all I can find in the "Form Structures" chapter](https://learn.microsoft.com/en-us/previous-versions/visualstudio/visual-basic-6/aa241723%28v=vs.60%29) says ASCII. But clearly that can't be right if the source has non-ASCII characters in it. My *guess* would be that it's in the system's default ANSI code page, as would be typical for pre-Unicode applications, but I'd love to find a citation for that. –  Aug 30 '19 at 01:26
  • windows-1252 did the trick – John Smith Aug 30 '19 at 13:18
  • I opened an FRM in Notepad++ and it says UTF-8. That was a surprise... – StayOnTarget Sep 03 '19 at 11:23

1 Answers1

2

After testing this encoding as windows-1252 preserves the characters.

John Smith
  • 61
  • 3
  • 2
    That is not precise. The compiler uses ACP so for example I'm able to compile cyrillic texts in my executables using Windows-1251 for system codepage for non-unicode applications here. – wqw Sep 02 '19 at 10:41