Ir vis tik perkoduoti tiesiogiai negalima. O tai reiškia, kad taisyklėse (ir kiek matau, kad būtent taisyklių skaičiukuose: pradžia ir ilgis) įsiūta koduotės specifika, o konkrečiai multibaitiniai reikalai.
hyphen substrings.pl:
# 8 bit or UTF-8 character length (calculating right start position for discretionary hyphenation)
sub enclen {
my $nonchar = 0;
my $len = length($_[0]);
if ($encoding eq "UTF-8") {
# length of an UTF-8 string equals to the count of the characters not started with '10' bits
for ($i = 0; $i < $len; $i++) {
if ((ord(substr($_[0], $i, 1)) >> 6) == 2) { $nonchar++; }
}
}
return $len - $nonchar;
}
Ir vis tik perkoduoti tiesiogiai negalima. O tai reiškia, kad taisyklėse (ir kiek matau, kad būtent taisyklių skaičiukuose: pradžia ir ilgis) įsiūta koduotės specifika, o konkrečiai multibaitiniai reikalai.
hyphen substrings.pl:
# 8 bit or UTF-8 character length (calculating right start position for discretionary hyphenation)
sub enclen {
my $nonchar = 0;
my $len = length($_[0]);
if ($encoding eq "UTF-8") {
# length of an UTF-8 string equals to the count of the characters not started with '10' bits
for ($i = 0; $i < $len; $i++) {
if ((ord(substr($_[0], $i, 1)) >> 6) == 2) { $nonchar++; }
}
}
return $len - $nonchar;
}