c# - How to find whether the stream has an unicode -


I have a file name "Connecticut is now 2 degrees C.T.T." In which there is a Unicode but the content of the file was just used to identify the code before the normal letter that the file name has Unicode, so the file was written with Unicode details. There is a conflict in the output file in this manner of implementation. So anyone can tell whether the file stream has a Unicode in it.

Thanks in advance,

Lokesh.

The simplest strategy so far is to decide on an encoding for a particular file, e.g. UTF-8, and especially use it when you write it down and then when you read it. Trying to find out what encoding is definitely a problem, so finding it is not the best.


UPDATE

You specify the following comments that you want to write a file that is unknown to any other encoding Created by

It is impossible to do this with complete 100% reliability in general.

If you are lucky then you think the file comes with one. In that case you can read the BOM and thus you can guess the encoding. There is no requirement for a text file that contains a BOM and they often do not.

However, I urge you to agree with an interchange format with those files. Choose a single encoding and always use it.

Comments