Problems with SHIFTED mode in StringSearch.
1. As far as I understand
(http://www.unicode.org/unicode/reports/tr10/#Variable_Weighting)
SHIFTED mode should be default, but it is not in ICU.
2. Setting SHIFTED mode explicitly causes “infinite loop”
in StringSearch when searched string ends with pattern.
I tried both 2.6 and the latest 2.8 jars.
This problem stops me from adapting ICU for our projects.
Let me know if there is a standard way of bug reporting.
test-case
import java.text.StringCharacterIterator;
import com.ibm.icu.text.Collator;
import com.ibm.icu.text.RuleBasedCollator;
import com.ibm.icu.text.StringSearch;
public class ICUCollator{
public static void main(String argv[]){ indexesOf("d", "d"); }
static void indexesOf(final String text, final String pattern){
RuleBasedCollator m_collator = (RuleBasedCollator)Collator.getInstance();
m_collator.setAlternateHandlingShifted(true);// Ok without this line
final StringCharacterIterator target = new
StringCharacterIterator(text);
StringSearch m_search = new StringSearch(pattern, target, m_collator);
int startOffset = m_search.first();
}
}