Bug 27954 - Comparing strings with an Umlaute fails
Summary: Comparing strings with an Umlaute fails
Status: RESOLVED ANSWERED
Alias: None
Product: Runtime
Classification: Mono
Component: General ()
Version: 3.12.0
Hardware: PC Mac OS
: --- normal
Target Milestone: ---
Assignee: Bugzilla
URL:
Depends on:
Blocks:
 
Reported: 2015-03-12 09:39 UTC by John Miller [MSFT]
Modified: 2015-03-12 16:43 UTC (History)
2 users (show)

Tags:
Is this bug a regression?: ---
Last known good build:


Attachments
Test Case (23.12 KB, application/zip)
2015-03-12 09:39 UTC, John Miller [MSFT]
Details


Notice (2018-05-24): bugzilla.xamarin.com is now in read-only mode.

Please join us on Visual Studio Developer Community and in the Xamarin and Mono organizations on GitHub to continue tracking issues. Bugzilla will remain available for reference in read-only mode. We will continue to work on open Bugzilla bugs, copy them to the new locations as needed for follow-up, and add the new items under Related Links.

Our sincere thanks to everyone who has contributed on this bug tracker over the years. Thanks also for your understanding as we make these adjustments and improvements for the future.


Please create a new report on GitHub or Developer Community with your current version information, steps to reproduce, and relevant error messages or log files if you are hitting an issue that looks similar to this resolved bug and you do not yet see a matching new report.

Related Links:
Status:
RESOLVED ANSWERED

Description John Miller [MSFT] 2015-03-12 09:39:49 UTC
Created attachment 10293 [details]
Test Case

**Overview:**

   The attached example demonstrates an issue comparing strings that contain an Umlaute character.

**Steps to Reproduce:**

   1. Run the attached sample. 
   2. The console will output the result of the comparison.

**Actual Results:**

   The comparison returns false. 

**Expected Results:**

   The comparison returns true.

**Build Date & Platform:**

   Mono 3.12.1 
   Xam.Mac 1.10.0.2

**Additional Information:**

   Debugging the app and inspecting the variables will show that they appear to be the same. I did notice that if you copy/paste the variable values into a text editor you will get this: http://screencast.com/t/6HlhqtBvhHQ
Comment 1 Mikayla Hutchinson [MSFT] 2015-03-12 16:43:56 UTC
== is an ordinal comparison, i.e. character by character.

One of your strings has a combining umlaut and a u, i.e. TWO characters. The other has a u with an umlaut, i.e. ONE character.

You probably want a culture-aware comparison.

http://en.wikipedia.org/wiki/Combining_character

https://msdn.microsoft.com/en-us/library/system.string.op_equality%28v=vs.110%29.aspx

https://msdn.microsoft.com/en-us/library/system.stringcomparison%28v=vs.110%29.aspx