[Mono-bugs] [Bug 578240] New: Encoding problem on Linux when invalid characters in input. Encoding GetBates(string) creates invalid byte [] output

bugzilla_noreply at novell.com bugzilla_noreply at novell.com
Tue Feb 9 07:12:51 EST 2010


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

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


           Summary: Encoding problem on Linux when invalid characters in
                    input. Encoding  GetBates(string) creates invalid byte
                    [] output
    Classification: Mono
           Product: Mono: Runtime
           Version: 2.4.x
          Platform: 32bit
        OS/Version: openSUSE 11.1
            Status: NEW
          Severity: Normal
          Priority: P5 - None
         Component: generics
        AssignedTo: mono-bugs at lists.ximian.com
        ReportedBy: pkrzemo at gmail.com
         QAContact: mono-bugs at lists.ximian.com
          Found By: ---
           Blocker: ---


User-Agent:       Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 5.1;
Trident/4.0; .NET CLR 1.1.4322; InfoPath.1; .NET CLR 2.0.50727; .NET CLR
3.0.04506.30; .NET CLR 3.0.04506.648; .NET CLR 3.5.21022; .NET CLR
3.0.4506.2152; .NET CLR 3.5.30729)

Different behavior than that in Microsofts .NET 2.0 runtime(and above).
GetBytes gives corrupted output. It inserts additional "?" characters, but the
output vector size is not expanded to accomodate extra characters. So it
introduses meaningless "?" in the middle, and in the same time trims valid
fragment from end of the vector.

Reproducible: Always

Steps to Reproduce:
1.Encoding  enc= Encoding.GetEncoding("ISO-8859-2");
2.string s="some string with chars from wrong encoding (should be Windows-1250
but has DOS CP in some chars)"
3.byte [] output=enc.GetBytes(s); //it gives wrong output
Actual Results:  
source="abcdX123" - where X is the char in wrong encoding.
output="abcd?X12" - that is in mono
output="abcdX123" - that is in .NET 2.0 runtime

Expected Results:  
output="abcdX123" - on both Ms.NET2.0  and mono (since encoding is 1-byte
wide).
or maybe
output="abcd?X123" if it has to be with "?". But it differs from Ms.NET

-- 
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