Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //link https://yadi.sk/i/zRspd1C8rgKk8g
- #!/bin/bash
- IFS=$'\n'
- if [ -n "$1" ]
- then
- for y in `find . -type d`; do
- txt="$y/*.txt"
- c="$y/*.c"
- h="$y/*.h"
- html="$y/*.html"
- if [ "$1" = "koi8" ] || [ "$1" = "koi7" ] || [ "$1" = "cp1251" ] || [ "$1" = "KOI8" ] || [ "$1" = "KOI7" ] || [ "$1" = "CP1251" ]
- then
- case "$1" in
- "koi8" | "KOI8")
- FROM_ENCODING="KOI8" ;;
- "cp1251" | "CP1251")
- FROM_ENCODING="CP1251" ;;
- "koi7" | "KOI7")
- FROM_ENCODING="KOI7" ;;
- esac
- TO_ENCODING="UTF8"
- for file in $c
- do
- iconv -f $FROM_ENCODING -t $TO_ENCODING $file -o $file.u
- done
- for file in $h
- do
- iconv -f $FROM_ENCODING -t $TO_ENCODING $file -o $file.u
- done
- for file in $html
- do
- iconv -f $FROM_ENCODING -t $TO_ENCODING $file -o $file.u
- done
- for file in $txt
- do
- iconv -f $FROM_ENCODING -t $TO_ENCODING $file -o $file.u
- done
- fi
- done
- else
- echo "No parameters found. "
- fi
- exit 0
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement