AA和丹麦文整理有什么用? [英] What is it about AA and Danish Collation?

查看:89
本文介绍了AA和丹麦文整理有什么用?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有以下Perl脚本,目的是显示丹麦语的排序规则.

I have the following Perl script, intended to show collation in Danish.

#!/usr/local/ActivePerl-5.16/bin/perl

use 5.014_001;
use utf8;
use Unicode::Collate;
use strict;
use warnings;
use Carp;
use Data::Dump;
use Encode qw( encode_utf8 );
use Unicode::Collate::Locale;


binmode STDOUT, ':encoding(UTF-8)';

my @words =("AAI Document Type", "Apple", "Zebra");

my $coll = Unicode::Collate::Locale->new(locale => "da");

my @result = $coll->sort(@words);


foreach my $item (@result){
print $item, "\n";
}

它输出

Apple
Zebra
AAI Document Type

为什么"AAI文档类型"结尾?似乎有一些有关"AA"的东西触发了这种行为.

Why does "AAI Document Type" go to the end? There seems to be something about "AA" that triggers this behavior.

推荐答案

AA在丹麦语中被视为单个字母,也写为Å.

AA is treated as a single letter in Danish, also written as Å.

详细信息此处.

很明显,缩写为AAI,将AA视为Å是不合适的(实际上是两个A字符).我想避免这种情况的方法是使用其他排序规则.

Obviously in an abbreviation like AAI, treating the AA as Å isn't appropriate (it really is two A characters). I suppose the way to avoid that would be to use a different collation.

这篇关于AA和丹麦文整理有什么用?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆