From 0a12b69d2cc27a5c281a81a3538943b0b4ea4ca0 Mon Sep 17 00:00:00 2001
From: Lan Hui <lanhui@zjnu.edu.cn>
Date: Wed, 2 Oct 2024 10:30:46 +0800
Subject: [PATCH] Show Chinese characters properly (related to Bug 200)

---
 Course.php      | 8 ++++----
 Submissions.php | 8 ++++----
 2 files changed, 8 insertions(+), 8 deletions(-)

diff --git a/Course.php b/Course.php
index 6d8abd7..c84ccff 100644
--- a/Course.php
+++ b/Course.php
@@ -324,10 +324,10 @@ include 'Header.php';
 					$att2 = $row['Attachment2'];
 					$att3 = $row['Attachment3'];
 					$att4 = $row['Attachment4'];
-					$base_att1 = basename($att1);
-					$base_att2 = basename($att2);
-					$base_att3 = basename($att3);
-					$base_att4 = basename($att4);
+					$base_att1 = basename(rawurldecode($att1));
+					$base_att2 = basename(rawurldecode($att2));
+					$base_att3 = basename(rawurldecode($att3));
+					$base_att4 = basename(rawurldecode($att4));
 
 					$full_link = "<a href='~\..\Download.php?file=$att1&attachment=1'>$base_att1</a>";  // prevent students from directly accessing their classmates' submissions
 
diff --git a/Submissions.php b/Submissions.php
index 2154fd8..29fa29e 100644
--- a/Submissions.php
+++ b/Submissions.php
@@ -151,10 +151,10 @@ echo "<div><a href='Courses.php?course=$url'> $header </a></div>";
                                 $submitted_by = "$student_name ($submitter_student_number) for group $groupname ";
                             }
 
-                            $base_att1 = basename($att1);
-                            $base_att2 = basename($att2);
-                            $base_att3 = basename($att3);
-                            $base_att4 = basename($att4);
+                            $base_att1 = basename(rawurldecode($att1));
+                            $base_att2 = basename(rawurldecode($att2));
+                            $base_att3 = basename(rawurldecode($att3));
+                            $base_att4 = basename(rawurldecode($att4));
 
                             $full_link = "<a href='~\..\Download.php?file=$att1&attachment=1'>$base_att1</a>";  // prevent students from directly accessing their classmates' submissions