Commit b92bda9a authored by Martin Klimeš's avatar Martin Klimeš
Browse files

add URI encoding

parent 10756b3c
...@@ -140,11 +140,16 @@ sub prompt_password { ...@@ -140,11 +140,16 @@ sub prompt_password {
} }
return $password1; return $password1;
} }
sub encode_uri {
my ($source) = @_;
$source =~ s/([^^A-Za-z0-9])/ sprintf "%%%02x", ord $1 /eg;
return $source
}
sub get_url { sub get_url {
my ($printer_name) = @_; my ($printer_name) = @_;
my $user = prompt_username(); my $user = encode_uri(prompt_username());
my $password = prompt_password(); my $password = encode_uri(prompt_password());
$printer_name = encode_uri($printer_name);
return "smb://NTFI\\${user}:${password}\@print.fi.muni.cz/$printer_name"; return "smb://NTFI\\${user}:${password}\@print.fi.muni.cz/$printer_name";
} }
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment