Index: /trunk/LMDZ.COMMON/makelmdz_fcm
===================================================================
--- /trunk/LMDZ.COMMON/makelmdz_fcm	(revision 3595)
+++ /trunk/LMDZ.COMMON/makelmdz_fcm	(revision 3596)
@@ -608,4 +608,13 @@
 current_date=$(date)
 
+# Function to process problematic characters
+#     Delete invalid character due to encoding format
+#     Escape backslashes and single quotes
+clean_output() {
+    echo "$1" \
+        | iconv -f "$(locale charmap)" -t UTF-8//IGNORE \
+        | sed 's/\\/\\\\/g; s/'\''/'\'\''/g'
+}
+
 # Iterate through subdirectories in $LMDGCM/../ to determine version control system
 vcs_info=""
@@ -619,11 +628,11 @@
     # Determine the version control system for each subdirectory
     if command -v svn > /dev/null && svn info "$dir" > /dev/null 2>&1; then # SVN
-        vcs_info+="\n-> SVN Information for \"$(basename "$dir")\"\n$(svn info "$dir" | iconv -f "$(locale charmap)" -t UTF-8//IGNORE)\n"
-        vcs_diff+="\n-> SVN Diff for \"$(basename "$dir")\"\n$(svn diff "$dir" | iconv -f "$(locale charmap)" -t UTF-8//IGNORE)\n"
-        vcs_stat+="\n-> SVN Status for \"$(basename "$dir")\"\n$(svn status "$dir" | iconv -f "$(locale charmap)" -t UTF-8//IGNORE)\n"
+        vcs_info+="\n-> SVN Information for \"$(basename "$dir")\"\n$(svn info "$dir" | clean_output)\n"
+        vcs_diff+="\n-> SVN Diff for \"$(basename "$dir")\"\n$(svn diff "$dir" | clean_output)\n"
+        vcs_stat+="\n-> SVN Status for \"$(basename "$dir")\"\n$(svn status "$dir" | clean_output)\n"
     elif command -v git > /dev/null && git -C "$dir" rev-parse --is-inside-work-tree > /dev/null 2>&1; then # Git
-        vcs_info+="-> Git Information for \"$(basename "$dir")\"\n$(git -C "$dir" log -1 --pretty=format:"%H%n%an%n%ad%n%s" | iconv -f "$(locale charmap)" -t UTF-8//IGNORE)\n"
-        vcs_diff+="\n-> Git Diff for \"$(basename "$dir")\"\n$(git -C "$dir" diff | iconv -f "$(locale charmap)" -t UTF-8//IGNORE)\n"
-        vcs_stat+="\n-> Git Status for \"$(basename "$dir")\"\n$(git -C "$dir" status --short | iconv -f "$(locale charmap)" -t UTF-8//IGNORE)\n"
+        vcs_info+="-> Git Information for \"$(basename "$dir")\"\n$(git -C "$dir" log -1 --pretty=format:"%H%n%an%n%ad%n%s" | clean_output)\n"
+        vcs_diff+="\n-> Git Diff for \"$(basename "$dir")\"\n$(git -C "$dir" diff | clean_output)\n"
+        vcs_stat+="\n-> Git Status for \"$(basename "$dir")\"\n$(git -C "$dir" status --short | clean_output)\n"
     else # None
         vcs_info+="\n-> No version control system for \"$(basename "$dir")\"\n"
@@ -667,5 +676,5 @@
     echo "write(*,'(a)') '=== Version Control Information ==='" >> "$info_file"
     while IFS= read -r line; do
-        echo "write(*,'(a)') '${line//\'/\'\'}'" >> "$info_file"
+        echo "write(*,'(a)') '${line}'" >> "$info_file"
     done <<< "$(echo -e "$vcs_info")"
 else
@@ -679,5 +688,5 @@
     echo "open(unit = 1, file = \"${res_file}\",status = 'replace',action = 'write')" >> "$info_file"
     while IFS= read -r line; do
-        echo "write(1,'(a)') '${line//\'/\'\'}'" >> "$info_file"
+        echo "write(1,'(a)') '${line}'" >> "$info_file"
     done <<< "$(echo -e "$vcs_stat")"
     echo "close(1)" >> "$info_file"
@@ -690,5 +699,5 @@
     echo "open(unit = 1, file = \"${res_file}\",status = 'unknown',position = 'append',action = 'write')" >> "$info_file"
     while IFS= read -r line; do
-        echo "write(1,'(a)') '${line//\'/\'\'}'" >> "$info_file"
+        echo "write(1,'(a)') '${line}'" >> "$info_file"
     done <<< "$(echo -e "$vcs_diff")"
     echo "close(1)" >> "$info_file"
