Skip to content
This repository has been archived by the owner on Feb 5, 2023. It is now read-only.

Resolve Wide character error #5

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 8 additions & 2 deletions s3curl.pl
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@
# you might need to use CPAN to get these modules.
# run perl -MCPAN -e "install <module>" to get them.

use utf8;
use Encode;
use Digest::HMAC_SHA1;
use FindBin;
use MIME::Base64 qw(encode_base64);
Expand All @@ -29,9 +31,13 @@
# begin customizing here
my @endpoints = ( 's3.amazonaws.com',
's3-us-west-1.amazonaws.com',
's3-us-west-2.amazonaws.com',
's3-us-gov-west-1.amazonaws.com',
's3-eu-west-1.amazonaws.com',
's3-ap-southeast-1.amazonaws.com',
's3-ap-northeast-1.amazonaws.com' );
's3-ap-northeast-1.amazonaws.com',
's3-ap-northeast-2.amazonaws.com',
's3-sa-east-1.amazonaws.com', );

my $CURL = "curl";

Expand Down Expand Up @@ -236,7 +242,7 @@

debug("StringToSign='" . $stringToSign . "'");
my $hmac = Digest::HMAC_SHA1->new($secretKey);
$hmac->add($stringToSign);
$hmac->add(Encode::encode_utf8($stringToSign));
my $signature = encode_base64($hmac->digest, "");
debug("signature='" . $signature. "'");

Expand Down