, , UTF-8, UTF-8. RegExps .Net, -, , . (, mycommand -autodetect) , .
string result=String.Empty;
Encoding ae = Encoding.GetEncoding(
Encoding.UTF8.EncodingName,
new EncoderExceptionFallback(),
new DecoderExceptionFallback());
try {
result=ae.GetString(mybytes);
}
catch (DecoderFallbackException e)
{
result=Encoding.Default.GetString(mybytes);
}
If you can interact with unmanaged code, explore the MLANG dll that ships with IE. It has alternative encoding auto-detection methods that may be more useful.
source
share