Skip to content

Commit

Permalink
Better decode the ChangeLog
Browse files Browse the repository at this point in the history
It's apparently in UTF-8 and we want to be able to show names like
Jean-Gérard Pailloncy properly.
  • Loading branch information
afresh1 committed Aug 24, 2013
1 parent 31d294e commit 46a06a8
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions commits-to-twitter.pl
Expand Up @@ -16,7 +16,8 @@
########################################################################
use strict;
use warnings;
use 5.010;
use 5.012;
use Encode qw(encode decode);

use DB_File;
use File::Basename;
Expand Down Expand Up @@ -176,8 +177,9 @@ sub shorten {
sub tweet {
my ( $message, $params ) = @_;

say "Tweeting [$message]";
eval { get_twitter_account( $params->{who} )->update($message) };
say encode('UTF-8', "Tweeting [$message]");
my $encoded = encode('UTF-8', $message);
eval { get_twitter_account( $params->{who} )->update($encoded) };
if ($@) {

# If we have what Twitter thinks is a URL, they are going to
Expand Down Expand Up @@ -244,7 +246,8 @@ sub parse_changelog {
open my $fh, '<', $file or die $!;
my $key = '';
my $dir = '';
while (<$fh>) {
while (1) {
$_ = decode('UTF-8', readline $fh) || last;
chomp;

if (/^\s*(CVSROOT|Module name|Changes by|Release Tags):\s+(.*)$/) {
Expand Down

0 comments on commit 46a06a8

Please sign in to comment.