I2P Address: [http://git.idk.i2p]

Skip to content
Snippets Groups Projects
checkutf8.sh 1.62 KiB
Newer Older
  • Learn to ignore specific revisions
  • zzz's avatar
    zzz committed
    #
    # Check for UTF-8 problems in all files where they might appear
    # Also check all Java source files
    # Returns nonzero on failure
    #
    # zzz 2010-12
    # public domain
    #
    
    cd `dirname $0`/../..
    
    # apps/routerconsole/jsp/ should only have UTF8 in help_xx.jsp
    
    DIRS="\
      apps/routerconsole/locale \
    
      apps/routerconsole/locale-news \
      apps/routerconsole/locale-countries \
    
    zzz's avatar
    zzz committed
      apps/i2ptunnel/locale \
    
      apps/i2ptunnel/locale-proxy \
    
    zzz's avatar
    zzz committed
      apps/i2psnark/locale \
    
      apps/ministreaming/locale \
    
    zzz's avatar
    zzz committed
      apps/susidns/locale \
    
    zzz's avatar
    zzz committed
      apps/susimail/locale \
    
    zzz's avatar
    zzz committed
      apps/desktopgui/locale \
    
    zzz's avatar
    zzz committed
      debian/po \
    
    kytv's avatar
    kytv committed
      installer/resources/eepsite/docroot/help \
    
    zzz's avatar
    zzz committed
      installer/resources/initialNews \
      installer/resources/proxy \
      installer/resources/readme \
      apps/routerconsole/jsp \
      apps/i2ptunnel/jsp \
      apps/susidns/src/jsp"
    
    for i in `find $DIRS -maxdepth 1 -type f`
    do
    	echo "Checking $i ..."
    	iconv -f UTF8 -t UTF8 $i -o /dev/null
            if [ $? -ne 0 ]
    	then
    		echo "********* FAILED CHECK FOR $i *************"
    		FAIL=1
    	fi
    done
    
    echo "Checking all Java files ..."
    for i in `find . -name \*.java -type f`
    do
    	#echo "Checking $i ..."
    	iconv -f UTF8 -t UTF8 $i -o /dev/null
            if [ $? -ne 0 ]
    	then
    		echo "********* FAILED CHECK FOR $i *************"
    		FAIL=1
    	fi
    done
    
    
    zzz's avatar
    zzz committed
    echo "Checking getopt properties files ..."
    for i in `find core/java/src/gnu/getopt -name \*.properties -type f`
    do
    	#echo "Checking $i ..."
    	iconv -f UTF8 -t UTF8 $i -o /dev/null
            if [ $? -ne 0 ]
    	then
    		echo "********* FAILED CHECK FOR $i *************"
    		FAIL=1
    	fi
    done
    
    
    zzz's avatar
    zzz committed
    if [ "$FAIL" != "" ]
    then
    	echo "******** At least one file failed check *********"
    else
    	echo "All files passed"
    fi
    exit $FAIL