6

we have an application written in Java which reads some text generated by a VB6 application. The problem is: this VB6 application generate this output using some special characters, like ç,ã,á which we don't know in what charset.

So the question is: is there a default charset used by VB6? Which is it?

Kico Lobo
  • 4,374
  • 4
  • 35
  • 48

2 Answers2

2

how do you transfer the data from one to the other? via file? if yes then it uses the machine default encoding i don't know the java code to get it, but in c# its Encoding.Default...

Peter
  • 37,042
  • 39
  • 142
  • 198
  • That's exactly how we are doing. Via file. Actually, what we discovered was this: as it was a command line application, it was executed on a MS-DOS environment, so it used it's default charset (windows-1252), not UTF-8 or UTF-16. – Kico Lobo Jan 12 '10 at 15:01
  • Never seen a vb6 ms dos application!... but the "Default Encoding" can be diffrent from computer to computer.... – Peter Jan 12 '10 at 17:40
1

Well,

here is what we discovered: We don't know if that was because our VB6 application was executed on the command line,but it was actually using the MS-DOS environment default charset, which in our case was the windows-1252.

So, all we had to do was to change our Java code to something like this:

InputStreamReader inputReader = new InputStreamReader(input, "windows-1252");

and it just worked fine!

Maybe it's even not because of the MS-DOS environment, but because we are getting this data from a Microsoft Access database. Personally, I think that this is the most probably solution for our problem.

Kico Lobo
  • 4,374
  • 4
  • 35
  • 48
  • 1
    Where does MS-DOS fit into this picture? VB6 programs can't run under MS-DOS. If you mean this is a command line program that's entirely different. If the program is writing a file you are reading, note that VB6 native I/O statements read/write text files using conversion between the current ANSI codepage and Unicode (UTF-16LE). The files would have 8-bit ANSI characters, and the codepage used for translation is based on the current locale settings. MS Access is another issue, but if the MDB is later than Jet 3.x format (engine type=4) most text should be UTF-16LE internally. – Bob77 Jan 12 '10 at 15:43
  • +1 to Bob. Michael Kaplan's excellent book on VB6 internationalisation explains all this in excruciating detail. The free sample chapter explains that VB6 I/O uses the default code page http://www.i18nwithvb.com/chapters/Chapter06_en.htm Minor niggle - it can be 16-bit, e.g. for Chinese – MarkJ Jan 12 '10 at 19:22