Exemplo n.º 1
0
 /// <summary>
 /// Tries to detect the file encoding.
 /// </summary>
 /// <param name="inputData">The input data.</param>
 /// <param name="start">The start.</param>
 /// <param name="count">The count.</param>
 /// <param name="defaultIfNotDetected">The default encoding if none was detected.</param>
 /// <returns></returns>
 public static Encoding DetectFileEncoding(byte[] inputData, int start, int count, Encoding defaultIfNotDetected = null)
 {
     var det = new FileEncoding ();
     det.Detect (inputData, start, count);
     return det.Complete () ?? defaultIfNotDetected;
 }
Exemplo n.º 2
0
 /// <summary>
 /// Tries to detect the file encoding.
 /// </summary>
 /// <param name="inputStream">The input stream.</param>
 /// <param name="defaultIfNotDetected">The default encoding if none was detected.</param>
 /// <returns></returns>
 public static Encoding DetectFileEncoding(Stream inputStream, Encoding defaultIfNotDetected = null)
 {
     var det = new FileEncoding ();
     det.Detect (inputStream);
     return det.Complete () ?? defaultIfNotDetected;
 }