Silverstripe 3错误排序与特殊字符(变音符号)

时间:2018-03-22 15:49:40

标签: php silverstripe

Silverstripe 3.6 当尝试按照以特殊字符开头的字段对ArrayList进行排序时 - 在我的情况下是德语变音符号 - 结果是没有“自然排序”

示例:

NSColor *color = [NSColor whiteColor];
NSMutableParagraphStyle *paragraphStyle = [[NSMutableParagraphStyle alloc] init];
[paragraphStyle setAlignment:NSTextAlignmentCenter];
NSString *content = @"Hello world!";
NSMutableAttributedString *title = [[NSMutableAttributedString alloc] initWithString:content attributes:@{
    NSForegroundColorAttributeName: color,
    NSBaselineOffsetAttributeName: @3,
    NSParagraphStyleAttributeName: paragraphStyle
}];
[button setAttributedTitle:title];

原始清单的结果:

$arrayList  = ArrayList::create(array(
  ArrayData::create(array('Title' => 'Ccc')),
  ArrayData::create(array('Title' => 'Zzz')),
  ArrayData::create(array('Title' => 'Ööö')),
  ArrayData::create(array('Title' => 'Aaa')),
  ArrayData::create(array('Title' => 'Rrr')),
  ArrayData::create(array('Title' => 'Ooo')),
  ArrayData::create(array('Title' => 'Äää'))
));

Debug::dump($arrayList->column('Title'));
$sortedList = $arrayList->sort('Title');
Debug::dump($sortedList->column('Title'));

排序列表的结果:

[0] => Ccc
[1] => Zzz
[2] => Ööö
[3] => Aaa
[4] => Rrr
[5] => Ooo
[6] => Äää

期望是:

[0] => Aaa
[1] => Ccc
[2] => Ooo
[3] => Rrr
[4] => Zzz
[5] => Äää
[6] => Ööö

将php5.6与intl扩展名一起使用。 任何想法,如何让这个工作?

0 个答案:

没有答案