[Mono-bugs] [Bug 473899] New: UnicodeEncoding.Unicode.GetString allows invalid code points through

bugzilla_noreply at novell.com bugzilla_noreply at novell.com
Mon Feb 9 08:51:11 EST 2009


https://bugzilla.novell.com/show_bug.cgi?id=473899


           Summary: UnicodeEncoding.Unicode.GetString allows invalid code
                    points through
    Classification: Mono
           Product: Mono: Class Libraries
           Version: 2.2.x
          Platform: x86
        OS/Version: Windows XP
            Status: NEW
          Severity: Normal
          Priority: P5 - None
         Component: CORLIB
        AssignedTo: mono-bugs at lists.ximian.com
        ReportedBy: joe at mistachkin.com
         QAContact: mono-bugs at lists.ximian.com
          Found By: ---


User-Agent:       Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.20)
Gecko/20081217 Firefox/2.0.0.20 (.NET CLR 3.5.30729)


The Eagle unit test fileIO-1.11 demonstrates an inconsistency between the
UnicodeEncoding implementations on Mono and .NET.  It also appears to
demonstrate that Mono is not in compliance with the Unicode standard.

The test fails because two code points from a range of "invalid" code points is
returned by UnicodeEncoding.Unicode.GetString, in this case U+D9D8 and U+DFDE.

>From the Wikipedia article "http://en.wikipedia.org/wiki/UTF-8":

<snip>
"Unicode also disallows the 2048 code points U+D800..U+DFFF (the UTF-16
surrogate pairs)."
</snip>


Reproducible: Always

Steps to Reproduce:
1. Download the "Mono-on-Unix" binaries distribution from: http://eagle.to/
2. Start the EagleShell.exe under the Mono of your choice (fails in 2.2, 2.0
has not been tested).
3. Type "set argv [list -constraints monoBug]; set no(sql) true" and hit enter.
4. Type "#test file-io*" and hit enter to see the failure (complete with stack
trace).

Alternatively, you should be able to reproduce this bug by reading the contents
of the test data file (included in the binary distribution as
"Eagle/tests/file.dat" and in the source distribution as
"Eagle/Library/Tests/file.dat") using File.ReadAllBytes or similar and then
calling UnicodeEncoding.Unicode.GetString() on the resulting byte array.

Actual Results:  
The unit test fails because the invalid code points U+D9D8 and U+DFDE are
returned.

Expected Results:  
The unit test should pass.

-- 
Configure bugmail: https://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