From 855d140b5e6c3d4477b89ae1e02e0833dcac7608 Mon Sep 17 00:00:00 2001
From: Gerhard Gonter <ggonter@gmail.com>
Date: Wed, 8 Jun 2022 19:02:25 +0200
Subject: [PATCH] utf8 handling

---
 lib/Univie/Utheses/API.pm | 10 ++++------
 1 file changed, 4 insertions(+), 6 deletions(-)

diff --git a/lib/Univie/Utheses/API.pm b/lib/Univie/Utheses/API.pm
index 847a3ce..1b2e896 100644
--- a/lib/Univie/Utheses/API.pm
+++ b/lib/Univie/Utheses/API.pm
@@ -28,8 +28,7 @@ sub getContainerPublicMetadata
   {
     eval
     {
-      # utf8::upgrade($res1);
-      $info= from_json(decode("utf8", $res1));
+      $info= from_json($res1);
     };
     if ($@)
     {
@@ -37,6 +36,7 @@ sub getContainerPublicMetadata
     }
   }
 
+  # TODO: Error handling!
   $info;
 }
 
@@ -51,15 +51,13 @@ sub utheses_request
 
   my $req_url= join ('/', $api_url, $what, $id);
   print __LINE__, " req_url=[$req_url]\n";
-  my $req = HTTP::Request->new(
-    $method => $req_url,
-  );
+  my $req = HTTP::Request->new( $method => $req_url );
 
   my $ua= LWP::UserAgent->new;
   my $res= $ua->request($req);
 
   # print __LINE__, " res: ", main::Dumper($res);
-  my $txt= $res->content();
+  my $txt= decode("utf8", $res->content());
   return ($res->code(), $txt);
 }
 
-- 
GitLab