Skip Menu |
 

This queue is for tickets about the Device-Gsm CPAN distribution.

Report information
The Basics
Id: 20906
Status: resolved
Worked: 1 hour (60 min)
Priority: 0/
Queue: Device-Gsm

People
Owner: cosimo [...] cpan.org
Requestors: n [...] shaplov.ru
Cc:
AdminCc:

Bug Information
Severity: Normal
Broken in: (no value)
Fixed in: (no value)



Subject: Problem with Russian letters in SMS
Download (untitled) / with headers
text/plain 124b
Device-Gsm does not work well with Russian (and other non 7-bit) letters in SMS. Here is a patch that solves this problem.
Subject: Pdu.pm.diff
Download Pdu.pm.diff
text/x-diff 494b
--- Pdu.pm.etalon 2006-08-03 18:36:18.000000000 +0400 +++ Pdu.pm 2006-08-09 14:00:15.214871448 +0400 @@ -81,6 +81,20 @@ $decoded; } +sub decode_test_UCS2 { + my $encoded= shift; + return undef unless $encoded; + + my $len = hex substr( $encoded, 0, 2 ); + $encoded = substr $encoded, 2; + + my $decoded=""; + while( $encoded ) { + $decoded.=pack("U",hex(substr($encoded,0,4))); + $encoded = substr($encoded,4); + } + return $decoded; +} sub encode_address { my $num = shift();
Subject: UD.pm.diff
Download UD.pm.diff
text/x-diff 892b
--- UD.pm.etalon 2006-08-03 15:57:40.000000000 +0400 +++ UD.pm 2006-08-09 13:58:48.016127672 +0400 @@ -31,11 +31,17 @@ my $ud_len = hex substr($$rMessage, 0, 2); # Finally get text of message - # XXX Here assume that DCS == 0x00 (7 bit coding) - my $text = Device::Gsm::Pdu::decode_text7($$rMessage); - - # Convert text from GSM 03.38 to Latin 1 - $text = Device::Gsm::Charset::gsm0338_to_iso8859($text); + my $dcs= $self->get('_messageTokens')->{'DCS'}->get('_data')->[0]; + my $text; + if ($dcs == 8) { + $text = Device::Gsm::Pdu::decode_test_UCS2($$rMessage); + } else { + # XXX Here assume that DCS == 0x00 (7 bit coding) + $text = Device::Gsm::Pdu::decode_text7($$rMessage); + + # Convert text from GSM 03.38 to Latin 1 + $text = Device::Gsm::Charset::gsm0338_to_iso8859($text); + } $self->set( 'length' => $ud_len ); $self->set( 'text' => $text );
Download (untitled) / with headers
text/plain 265b
Your patch has been included in Device::Gsm v1.44, soon at your local CPAN mirror. It would be perfect if you could send me a "test" PDU binary message to be decoded with the result of decoding, so I can add it as a test case. Thanks for your valuable contribution.


This service is sponsored and maintained by Best Practical Solutions and runs on Perl.org infrastructure.

Please report any issues with rt.cpan.org to rt-cpan-admin@bestpractical.com.