[LON-CAPA-cvs] cvs: loncom /interface lonexttool.pm /lti ltiroster.pm ltiutils.pm

raeburn raeburn at source.lon-capa.org
Tue Mar 29 16:12:46 EDT 2022


raeburn		Tue Mar 29 20:12:46 2022 EDT

  Modified files:              
    /loncom/lti	ltiutils.pm ltiroster.pm 
    /loncom/interface	lonexttool.pm 
  Log:
  - Bug 6754
    Documentation says to use Encode::decode('UTF-8',$string) instead of
    Encode::decode_utf8($string) for data exchange.
  
  
Index: loncom/lti/ltiutils.pm
diff -u loncom/lti/ltiutils.pm:1.17 loncom/lti/ltiutils.pm:1.18
--- loncom/lti/ltiutils.pm:1.17	Thu Jul 18 18:28:46 2019
+++ loncom/lti/ltiutils.pm	Tue Mar 29 20:12:46 2022
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # Utility functions for managing LON-CAPA LTI interactions 
 #
-# $Id: ltiutils.pm,v 1.17 2019/07/18 18:28:46 raeburn Exp $
+# $Id: ltiutils.pm,v 1.18 2022/03/29 20:12:46 raeburn Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -32,6 +32,7 @@
 use Net::OAuth;
 use Digest::SHA;
 use Digest::MD5 qw(md5_hex);
+use Encode;
 use UUID::Tiny ':std';
 use Apache::lonnet;
 use Apache::loncommon;
@@ -821,7 +822,7 @@
 sub setup_logout_callback {
     my ($uname,$udom,$server,$ckey,$secret,$service_url,$idsdir,$protocol,$hostname) = @_;
     if ($service_url =~ m{^https?://[^/]+/}) {
-        my $digest_user = &Encode::decode_utf8($uname.':'.$udom);
+        my $digest_user = &Encode::decode('UTF-8',$uname.':'.$udom);
         my $loginfile = &Digest::SHA::sha1_hex($digest_user).&md5_hex(&md5_hex(time.{}.rand().$$));
         if ((-d $idsdir) && (open(my $fh,'>',"$idsdir/$loginfile"))) {
             print $fh "$uname,$udom,$server\n";
Index: loncom/lti/ltiroster.pm
diff -u loncom/lti/ltiroster.pm:1.5 loncom/lti/ltiroster.pm:1.6
--- loncom/lti/ltiroster.pm:1.5	Tue Aug 14 23:50:20 2018
+++ loncom/lti/ltiroster.pm	Tue Mar 29 20:12:46 2022
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # LTI Consumer Module to respond to a course roster request.
 #
-# $Id: ltiroster.pm,v 1.5 2018/08/14 23:50:20 raeburn Exp $
+# $Id: ltiroster.pm,v 1.6 2022/03/29 20:12:46 raeburn Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -280,7 +280,7 @@
             }
             $r->print("    <member>\n");
             my ($uname,$udom) = split(/:/,$user);
-            my $digest_user = &Encode::decode_utf8($uname.':'.$udom);
+            my $digest_user = &Encode::decode('UTF-8',$uname.':'.$udom);
             $digest_user = &Digest::SHA::sha1_hex($digest_user);
             $r->print('      <user_id>'.$digest_user.'</user_id>'."\n");
             if (exists($students{$user})) {
@@ -348,7 +348,7 @@
                 next unless ($students{$user}[$statusidx] eq 'Active');
                 $r->print("    <member>\n");
                 my ($uname,$udom) = split(/:/,$user);
-                my $digest_user = &Encode::decode_utf8($uname.':'.$udom);
+                my $digest_user = &Encode::decode('UTF-8',$uname.':'.$udom);
                 $digest_user = &Digest::SHA::sha1_hex($digest_user);
                 $r->print('      <user_id>'.$digest_user.'</user_id>'."\n");
                 if ($needroles) {
Index: loncom/interface/lonexttool.pm
diff -u loncom/interface/lonexttool.pm:1.22 loncom/interface/lonexttool.pm:1.23
--- loncom/interface/lonexttool.pm:1.22	Sat Aug  7 01:32:12 2021
+++ loncom/interface/lonexttool.pm	Tue Mar 29 20:12:46 2022
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # Launch External Tool Provider (LTI)
 #
-# $Id: lonexttool.pm,v 1.22 2021/08/07 01:32:12 raeburn Exp $
+# $Id: lonexttool.pm,v 1.23 2022/03/29 20:12:46 raeburn Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -275,7 +275,7 @@
         $ltirole = 'Learner';
     }
     my @possdigest;
-    my $digest_user = &Encode::decode_utf8($uname.':'.$udom);
+    my $digest_user = &Encode::decode('UTF-8',$uname.':'.$udom);
     $digest_user = &Digest::SHA::sha1_hex($digest_user);
     push(@possdigest,$digest_user);
     if ($env{'course.'.$env{'request.course.id'}.'.languages'} ne '') {
@@ -298,7 +298,7 @@
     my ($title,$digest_symb);
     my ($symb) = &Apache::lonnet::whichuser();
     if ($symb) {
-        $digest_symb = &Encode::decode_utf8($symb);
+        $digest_symb = &Encode::decode('UTF-8',$symb);
         $digest_symb = &Digest::SHA::sha1_hex($digest_symb);
         push(@possdigest,$digest_symb);
         my $navmap = Apache::lonnavmaps::navmap->new();
@@ -427,7 +427,7 @@
         }
     }
     foreach my $key (keys(%ltiparams)) {
-        $ltiparams{$key} = &Encode::decode_utf8($ltiparams{$key});
+        $ltiparams{$key} = &Encode::decode('UTF-8',$ltiparams{$key});
     }
     $ltiparams{'basiclti_submit'} = $submittext;
     return %ltiparams;




More information about the LON-CAPA-cvs mailing list