Charlie Poole
2008-03-23 18:11:40 UTC
Hi All,
I'm forwarding this bug to the list for discussion. You can comment here or
on the bug.
The gist of it is that Assert.AreEqual on strings uses string.Compare and
can find two strings equal even if they use different encodings. This makes
sense to me but it isn't how string.Equals or operator == work.
Your thoughts?
Charlei
-----Original Message-----
From: Nobody [mailto:***@sc8-sf-web23.sourceforge.net] On Behalf Of
SourceForge.net
Sent: Saturday, March 22, 2008 10:26 PM
To: ***@sourceforge.net
Subject: [ nunit-Bugs-1923458 ] Unexpected result from AreEqual/ANE for
encoded strings
Bugs item #1923458, was opened at 2008-03-23 06:25 Message generated for
change (Tracker Item Submitted) made by Item Submitter You can respond by
visiting:
https://sourceforge.net/tracker/?func=detail&atid=110749&aid=1923458&group_i
d=10749
Please note that this message will contain a full copy of the comment
thread, including the initial issue submission, for this request, not just
the latest update.
Category: framework
Group: 2.4.5
Status: Open
Resolution: None
Priority: 5
Private: No
Submitted By: Morten Mertner (mnmr)
Assigned to: Nobody/Anonymous (nobody)
Summary: Unexpected result from AreEqual/ANE for encoded strings
Initial Comment:
I would expect the following test to pass, however, it does not.
The strings do show up as different in the debugger (obviously, since
they're encoded differently) and the built-in == operator correctly returns
false when comparing the two variables.
[Test]
public void Simple()
{
string input = "Hello World";
byte[] data = Encoding.UTF32.GetBytes( input );
string garbage = Encoding.UTF8.GetString( data );
Assert.AreNotEqual( input, garbage );
}
----------------------------------------------------------------------
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=110749&aid=1923458&group_i
d=10749
-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
I'm forwarding this bug to the list for discussion. You can comment here or
on the bug.
The gist of it is that Assert.AreEqual on strings uses string.Compare and
can find two strings equal even if they use different encodings. This makes
sense to me but it isn't how string.Equals or operator == work.
Your thoughts?
Charlei
-----Original Message-----
From: Nobody [mailto:***@sc8-sf-web23.sourceforge.net] On Behalf Of
SourceForge.net
Sent: Saturday, March 22, 2008 10:26 PM
To: ***@sourceforge.net
Subject: [ nunit-Bugs-1923458 ] Unexpected result from AreEqual/ANE for
encoded strings
Bugs item #1923458, was opened at 2008-03-23 06:25 Message generated for
change (Tracker Item Submitted) made by Item Submitter You can respond by
visiting:
https://sourceforge.net/tracker/?func=detail&atid=110749&aid=1923458&group_i
d=10749
Please note that this message will contain a full copy of the comment
thread, including the initial issue submission, for this request, not just
the latest update.
Category: framework
Group: 2.4.5
Status: Open
Resolution: None
Priority: 5
Private: No
Submitted By: Morten Mertner (mnmr)
Assigned to: Nobody/Anonymous (nobody)
Summary: Unexpected result from AreEqual/ANE for encoded strings
Initial Comment:
I would expect the following test to pass, however, it does not.
The strings do show up as different in the debugger (obviously, since
they're encoded differently) and the built-in == operator correctly returns
false when comparing the two variables.
[Test]
public void Simple()
{
string input = "Hello World";
byte[] data = Encoding.UTF32.GetBytes( input );
string garbage = Encoding.UTF8.GetString( data );
Assert.AreNotEqual( input, garbage );
}
----------------------------------------------------------------------
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=110749&aid=1923458&group_i
d=10749
-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/