| 1 | #!/bin/bash |
| 2 | |
| 3 | usage(){ |
| 4 | echo " |
| 5 | Written by Brian Bushnell |
| 6 | Last modified October 17, 2017 |
| 7 | |
| 8 | Description: Replaces unicode and control characters with printable ascii characters. |
| 9 | WARNING - this does not work in many cases, and is not recommended! |
| 10 | It is only retained because there is some situation in which it is needed. |
| 11 | |
| 12 | Usage: unicode2ascii.sh in=<file> out=<file> |
| 13 | |
| 14 | Please contact Brian Bushnell at [email protected] if you encounter any problems. |
| 15 | " |
| 16 | } |
| 17 | |
| 18 | #This block allows symlinked shellscripts to correctly set classpath. |
| 19 | pushd . > /dev/null |
| 20 | DIR="${BASH_SOURCE[0]}" |
| 21 | while [ -h "$DIR" ]; do |
| 22 | cd "$(dirname "$DIR")" |
| 23 | DIR="$(readlink "$(basename "$DIR")")" |
| 24 | done |
| 25 | cd "$(dirname "$DIR")" |
| 26 | DIR="$(pwd)/" |
| 27 | popd > /dev/null |
| 28 | |
| 29 | #DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )/" |
| 30 | CP="$DIR""current/" |
| 31 | |
| 32 | z="-Xmx200m" |
| 33 | set=0 |
| 34 | |
| 35 | if [ -z "$1" ] || [[ $1 == -h ]] || [[ $1 == --help ]]; then |
| 36 | usage |
| 37 | exit |
| 38 | fi |
| 39 | |
| 40 | calcXmx () { |
| 41 | source "$DIR""/calcmem.sh" |
| 42 | setEnvironment |
| 43 | parseXmx "$@" |
| 44 | } |
| 45 | calcXmx "$@" |
| 46 | |
| 47 | function unicode2ascii() { |
| 48 | local CMD="java $EA $EOOM $z -cp $CP jgi.UnicodeToAscii $@" |
| 49 | echo $CMD >&2 |
| 50 | eval $CMD |
| 51 | } |
| 52 | |
| 53 | unicode2ascii "$@" |