From 91a5b1e13a8ca596d05c85cf7b5546b9975425c0 Mon Sep 17 00:00:00 2001
From: srosse <none@none>
Date: Wed, 27 Apr 2016 11:59:26 +0200
Subject: [PATCH] OO-2001: replace quote by double quotes in csv archive of
 courses (patch S. Clemenz)

---
 .../org/olat/course/archiver/ScoreAccountingHelper.java     | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/src/main/java/org/olat/course/archiver/ScoreAccountingHelper.java b/src/main/java/org/olat/course/archiver/ScoreAccountingHelper.java
index d9979c763e4..7c14a66056c 100644
--- a/src/main/java/org/olat/course/archiver/ScoreAccountingHelper.java
+++ b/src/main/java/org/olat/course/archiver/ScoreAccountingHelper.java
@@ -266,8 +266,9 @@ public class ScoreAccountingHelper {
 						if (comment != null) {
 							// put comment between double quote in order to prevent that
 							// '\t','\r' or '\n' destroy the excel table
+							// A (double) quote must be represented by two (double) quotes.
 							tableContent.append("\"");
-							tableContent.append(comment);
+							tableContent.append(comment.replace("\"", "\"\""));
 							tableContent.append("\"\t");
 						} else {
 							tableContent.append(mi);
@@ -286,8 +287,9 @@ public class ScoreAccountingHelper {
 						if (coachComment != null) {
 							// put coachComment between double quote in order to prevent that
 							// '\t','\r' or '\n' destroy the excel table
+							// A (double) quote must be represented by two (double) quotes.
 							tableContent.append("\"");
-							tableContent.append(coachComment);
+							tableContent.append(coachComment.replace("\"", "\"\""));
 							tableContent.append("\"\t");
 						} else {
 							tableContent.append(mi);
-- 
GitLab