TT#12662 Correctly calculate number of parts

Also take into account latin1 characters when calculating number
of parts for billing, because SMS uses some special derivation of
latin-1 and can therefore encode certain chars without the use of
UTF-8.

Change-Id: Ia7f02a3cf96040e5ad23da9037d05422beecea74
changes/46/12146/1
Andreas Granig 9 years ago
parent 096749ef4d
commit 98e4b64294

@ -167,8 +167,9 @@ sub _glob_matches {
sub get_number_of_parts {
my $text = shift;
my $maxlen;
if(NGCP::Panel::Utils::Utf8::is_within_ascii($text)) {
# multi-part sms consist of 153 char chunks in ascii,
if(NGCP::Panel::Utils::Utf8::is_within_ascii($text) ||
NGCP::Panel::Utils::Utf8::is_within_latin1($text)) {
# multi-part sms consist of 153 char chunks in ascii/latin1,
# otherwise 160 for single sms
$maxlen = length($text) <= 160 ? 160 : 153;
} else {

Loading…
Cancel
Save