[Mono-dev] strictly decoding ascii

Atsushi Eno atsushi at ximian.com
Tue Dec 6 19:38:52 EST 2005

AFAIK there is no such flag like "throwOnInvalid" .ctor parameter in
UTF8Encoding. In 2.0 profile, there is DecoderExceptionFallback which
is being implemented in mono (I'm working on it). On ASCIIEncoding
it should work. (If it does not work, please file a bug.)

Basically in 1.0 profile encoder/decoder behaviors are inconsistent;
some of they might put '?' for invalid bytes, and some just ignores.

Atsushi Eno

Grant Monroe wrote:
> I posted a bug about System.Text.ASCIIEncoding yesterday. Essentially
> the problem I have is that I expected this Encoding to be able to
> decode an array of bytes, and give me an error if the bytes aren't
> valid ascii. Perhaps I am missing something, but
> Encoding.ASCII.GetString(data) seems to succeed even if the bytes
> aren't valid ascii. I thought perhaps there would be some
> functionality similar to the UTF8Encoding where you can pass a flag to
> the constructor to tell it to be strict or not. Any thoughts?
> _______________________________________________
> Mono-devel-list mailing list
> Mono-devel-list at lists.ximian.com
> http://lists.ximian.com/mailman/listinfo/mono-devel-list

More information about the Mono-devel-list mailing list