0

here is the situation:

I have string1 using charset 186 (BALTIC_CHARSET). I have string2 using charset 204 (RUSSIAN_CHARSET). I can save these strings in to oracle database. I can see those strings as they should only when I change to particular charset. That is no problem. Problem is how do I save string2 to .text file and see it as it should. Now when I save it I get nonsense.

I am new to all the unicode or ansi or other. Can I get what I want using vb.net? How do I do that then? Thanks.

Deanna
  • 23,876
  • 7
  • 71
  • 156
babboon
  • 683
  • 3
  • 20
  • 45

1 Answers1

1

A text file doesn't have a codepage itself so it will be displayed as the selected codepage at the time you view it (the same as the value in the database would).

The correct way to handle this is to use unicode which VB uses internally, but (by default) will convert from and to the current local codepage when displaying or saving to a file.

You can save this file as UTF-8 or UCS-2 by appending the BOM character to the beginning and just writing out the string data from memory using something like:

Dim Content() As Byte
Content = ChrW(&HFEFF) & StringVariable
FileNum = FreeFile()
Open FileName For Binary As #FileNum
Put #filenum, Content
Close #FileNum

(Untested air code)

Community
  • 1
  • 1
Deanna
  • 23,876
  • 7
  • 71
  • 156