Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Attempt to fix UTF8 problems by renaming files before we process them…

… instead
  • Loading branch information...
commit 3b29f9dd3ec4c81f12611b0d971e36aa8e681476 1 parent 4c03268
@mhagander authored
Showing with 9 additions and 2 deletions.
  1. +9 −2 convert_cron.sh
View
11 convert_cron.sh
@@ -25,8 +25,8 @@ date +"%Y-%m-%d %H:%M:%S Scanning directory..." >> $LOG
# If there are any files to convert, send them through the converter
cd /usr/local/word2mediawiki
FIRST=1
-for F in $(find share -type f) ; do
- date +"%Y-%m-%d %H:%M:%S Converting $F..." >> $LOG
+for OLDF in $(find share -type f) ; do
+ date +"%Y-%m-%d %H:%M:%S Converting $OLDF..." >> $LOG
if [ "$FIRST" == "1" ]; then
# If there is an instance of openoffice running, get rid of it
# (there should never be one)
@@ -40,8 +40,15 @@ for F in $(find share -type f) ; do
sleep 5
FIRST=0
fi
+
+ # Get rid of strange characters
+ F=$(echo "$OLDF" | iconv -f utf8 -t ascii//ignore)
+ mv -v -f "$OLDF" "$F" >> $LOG
+
python word2mediawiki.py "$F" >> $LOG 2>&1
+
rm -f "$F"
+
date +"%Y-%m-%d %H:%M:%S Done with $F, removing." >> $LOG
done
Please sign in to comment.
Something went wrong with that request. Please try again.