[Mono-bugs] [Bug 565129] New: UTF8Encoding doesn't throw on incomplete characters

bugzilla_noreply at novell.com bugzilla_noreply at novell.com
Wed Dec 16 07:51:02 EST 2009


http://bugzilla.novell.com/show_bug.cgi?id=565129

http://bugzilla.novell.com/show_bug.cgi?id=565129#c0


           Summary: UTF8Encoding doesn't throw on incomplete characters
    Classification: Mono
           Product: Mono: Runtime
           Version: 2.6.x
          Platform: x86
        OS/Version: TurboLinux 6.0
            Status: NEW
          Severity: Normal
          Priority: P5 - None
         Component: misc
        AssignedTo: mono-bugs at lists.ximian.com
        ReportedBy: tomas.matousek at microsoft.com
         QAContact: mono-bugs at lists.ximian.com
          Found By: ---
           Blocker: ---


User-Agent:       Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.1;
Trident/4.0; SLCC2; .NET CLR 2.0.50727; .NET CLR 3.5.30729; .NET CLR 3.0.30729;
Media Center PC 6.0; InfoPath.3; MS-RTC LM 8; MALC)

This code should throw an exception since the characters are incomplete
surrogates and True is passed to the constructor's throwOnInvalidBytes
parameter.

            var s = new char[] { '\udf45', '\ud808' };
            try {
                new System.Text.UTF8Encoding(false, true).GetBytes(s, 0, 2);
            } catch (Exception e) {
                Console.WriteLine(e.Message);
            }

Reproducible: Always

Steps to Reproduce:
1. compile and run the code above
Actual Results:  
no exception thrown

Expected Results:  
System.Text.EncoderFallbackException:
Unable to translate Unicode character \uDF45 at index 0 to specified code page.

-- 
Configure bugmail: http://bugzilla.novell.com/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the QA contact for the bug.
You are the assignee for the bug.


More information about the mono-bugs mailing list