]> nuage.metani.fr Git - 3GPP.git/blobdiff - bin/docx2asn.sh
docx2asn.sh: adjusted removal of EN-dash and CR
[3GPP.git] / bin / docx2asn.sh
index 373abb9c73ef72e8eba644c53348da7cb4a2f88c..8a09bb5cdee972128ed03c9118ab1489c493a5b7 100755 (executable)
@@ -48,12 +48,16 @@ while [ "$#" -gt 0 ]; do
            continue
        fi
 
            continue
        fi
 
-       # On windows, soffice adds CR characters at line ends and produces EN-DASH in Windows-1252 enconding, i.e. 0x96
-       # Remove the CR at each line end and convert EN-DASH to normal minus
-       echo "${1%.docx}.txt"
-       LC_ALL=C sed -i $'s/\x96/-/g' "${1%.docx}.txt"
-       LC_ALL=C sed -i $'s/\r$//' "${1%.docx}.txt"
-
+       case $platform in
+           # Replace EN-DASH (UTF-8 encoding) at line start with -
+           Linux) LC_ALL=C sed -i $'s/^\u2013/-/g' "${1%.docx}.txt" ;;
+           
+           # Replace EN-DASH (Windows-1252 encoding) at line start with -
+           # Remove CR (0x0d) put by libreoffice in windows before each LF (0x0a)
+           CYGWIN*) LC_ALL=C sed -i $'s/^\x96/-/g; s/\r$//' "${1%.docx}.txt" ;;
+           *) echo "Unkown platform $platform"
+              exit 1;;
+       esac    
     fi
 
     if [[ -e "${1%.docx}.asn" ]] ; then
     fi
 
     if [[ -e "${1%.docx}.asn" ]] ; then