|
dev
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
How can I write to a file with different encoding?How can I write to the same file with different encoding?
The file has records where different fields in each record has different encoding (because of use in different modules in a production machine). Open and close several times (with different encoding) for each record is not whery efficient. You can open file once, and write to multiple positions.
You can write bytes that were obtained with special encoding, Lets suppose that you have 2 fields with UTF-8 and ASCII Then you can obtain bytes with appropriate encoding byte[] field1 = Encoding.ASCII.GetBytes(field1); byte[] field2 = Encoding.UTF8.GetBytes(field2); Now you get two fields encoded with 2 different encodings Show quote "Willy S" <Wil***@discussions.microsoft.com> wrote in message news:2708141B-C50E-411E-8D78-9549AC6D4572@microsoft.com... > > How can I write to the same file with different encoding? > The file has records where different fields in each record has different > encoding (because of use in different modules in a production machine). > Open and close several times (with different encoding) for each record is > not whery efficient. > > The file has records where different fields in each record has different This is really-really bad internationalization design.> encoding (because of use in different modules in a production machine). Go with a for of Unicode (UTF-8, UTF-16, whatever) and you will not be mistaken. -- Mihai Nita [Microsoft MVP, Windows - SDK] http://www.mihai-nita.net ------------------------------------------ Replace _year_ with _ to get the real email |
|||||||||||||||||||||||