Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion core/src/avm2/globals/flash/globalization/Collator.as
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,13 @@ package flash.globalization {

public function compare(string1:String, string2:String):int {
stub_method("flash.globalization.Collator", "compare");
return string1.localeCompare(string2);
// Flash Player normalizes the result to exactly -1, 0, or 1.
// Some callers rely on this: mx/spark collections' Sort.findItem
// does `switch (compareResult) { case -1: ...; case 1: ... }`, so a
// raw comparison delta (e.g. a character-code difference) would
// match no case and spin the binary search forever.
var result:int = string1.localeCompare(string2);
return (result < 0) ? -1 : ((result > 0) ? 1 : 0);
}

public function equals(string1:String, string2:String):Boolean {
Expand Down
Loading