[Mono-bugs] [Bug 586085] New: Number parsing is not CurrentCulture senstive

bugzilla_noreply at novell.com bugzilla_noreply at novell.com
Sat Mar 6 18:22:27 EST 2010


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

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


           Summary: Number parsing is not CurrentCulture senstive
    Classification: Mono
           Product: Mono: Class Libraries
           Version: unspecified
          Platform: Other
        OS/Version: Other
            Status: NEW
          Severity: Normal
          Priority: P5 - None
         Component: CORLIB
        AssignedTo: mono-bugs at lists.ximian.com
        ReportedBy: rkumpera at novell.com
         QAContact: mono-bugs at lists.ximian.com
          Found By: ---
           Blocker: ---


Run this:
        var cur = Thread.CurrentThread.CurrentCulture;
        cur = (CultureInfo)cur.Clone ();

        NumberFormatInfo ninfo = new NumberFormatInfo ();
        ninfo.NegativeSign = ">";
        ninfo.PositiveSign = "%";
        cur.NumberFormat = ninfo;

        Thread.CurrentThread.CurrentCulture = cur;

        int bla = 0;
        Console.WriteLine (int.TryParse (">11", out bla));
        Console.WriteLine (bla == -11);
        Console.WriteLine (int.TryParse ("%11", out bla));
        Console.WriteLine (bla == 11);


This should print true 4 times. On mono it doesn't because int32.TryParse
(string, out int) is culture insensitive.

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