summaryrefslogtreecommitdiff
path: root/localmarkdown2sms
diff options
context:
space:
mode:
authorJonas Smedegaard <dr@jones.dk>2010-09-24 14:37:10 +0200
committerJonas Smedegaard <dr@jones.dk>2010-09-24 14:37:10 +0200
commit627f8f410da72b5ca64b4145ccb22b53c97d4810 (patch)
treea7f70bdad1b0a9210a349621498a4061b0b77a20 /localmarkdown2sms
parent1d984ec05efb36596864b07dfbe15b82e879032e (diff)
Revert "Transliterate keyword and read_file(). Only encode during send."
This reverts commit 908fa5b08fb2fc1bfd8ed4f466e7ecffbe113aac.
Diffstat (limited to 'localmarkdown2sms')
-rwxr-xr-xlocalmarkdown2sms12
1 files changed, 6 insertions, 6 deletions
diff --git a/localmarkdown2sms b/localmarkdown2sms
index 0340084..40ba6c6 100755
--- a/localmarkdown2sms
+++ b/localmarkdown2sms
@@ -82,7 +82,7 @@ if ($stripprefix) {
}
# strip non-word chars from keyword
-$key = transliterate($key);
+$key = transliterate($sms_cp, $key);
# use only first chunk of word chars as keyword
$key =~ s/^(\S+).*?$/$1/;
@@ -106,7 +106,7 @@ foreach my $file (read_dir( $path )) {
# suppress repeated warnings for same issue
my ($warn_nonkey_delay, $warn_nonkey_content);
next unless ($file =~ /\.mdwn$/);
- foreach my $line (transliterate(read_file( File::Spec->catfile($path, $file)))) {
+ foreach my $line (read_file( File::Spec->catfile($path, $file))) {
chomp $line;
my $content;
# headline
@@ -202,9 +202,9 @@ sub tidymsg {
# based on Text::Unidecode bug#8017: http://rt.cpan.org/Ticket/Display.html?id=8017#txn-322351
sub transliterate {
- my $string = shift @_;
+ my ($tocharset, $string) = @_;
- my $res = encode('UTF-8', decode('GSM0338', encode('GSM0338', decode('UTF-8', $string), sub {
+ my $res = encode($tocharset, decode('GSM0338', encode('GSM0338', decode('UTF-8', $string), sub {
my $ascii = unidecode(chr $_[0]);
_utf8_off($ascii);
$ascii;
@@ -234,7 +234,7 @@ sub sendmsg {
$url .= '&validity=' . uri_escape($sms_validity) if ($sms_validity);
$url .= '&req_feat=' . uri_escape($sms_req_feat) if ($sms_req_feat);
$url .= '&binfo=' . uri_escape($sms_binfo) if ($sms_binfo);
- $url .= '&' . $sms_msgtag . '=' . uri_escape(encode($sms_cp, $msg));
+ $url .= '&' . $sms_msgtag . '=' . uri_escape(transliterate($sms_cp, $msg));
unless ($dummy) {
DEBUG "Sending request: $url";
my $response = $ua->request(HTTP::Request->new('GET', $url));
@@ -245,7 +245,7 @@ sub sendmsg {
} else {
DEBUG "[DUMMY] Sending request: $url";
print STDERR "\n [$from --> $to: $desc]\n\n";
- print STDERR $msg . "\n";
+ print STDERR transliterate($sms_cp, $msg) . "\n";
}
}