LukeSmithxyz / voidrice

My dotfiles (deployed by LARBS)
GNU General Public License v3.0
4.27k stars 1.21k forks source link

iconv wrong implementation on termux booksplit script #1357

Closed Simbaclaws closed 1 year ago

Simbaclaws commented 1 year ago

Hi,

I'm trying to use the booksplit script you made on an android phone using termux because I am on vacation and want to split some audio files and upload it to my smb share over a vpn.

However, the implementation of iconv inside termux is different from that on a distribution (I think....) and is giving me the following error message:

Usage: iconv [-c] [-s] [-f fromcode] [-t tocode] [file ...] or: iconv -l
Try: iconv --help for more information

And when I do iconv --help I am getting the following information:

Converts text from one encoding to another encoding.

Options controlling the input and output format:
    -f ENCODING, --from-code=ENCODING            the encoding of the input
    -t ENCODING, --to-code=ENCODING            the encoding of the output

Options controlling conversion problems:
    -c            discard unconvertible characters
    --unicode-subst=FORMATSTRING            substitution for unconvertible Unicode characters
    --byte-subst=FORMATSTRING            substitution for unconvertible Bytes
    --widechar-subst=FORMATSTRING            substitution for unconvertible wide characters

Options controlling error output:
    -s, --silent            suppress error messages about conversion problems

Informative output:
    -l, --list            list the supported encodings
    --help            display this help and exit
    --version            output version information and exit

Do you perhaps know how I can take this code from booksplit:

escbook="$(echo "$booktitle" | iconv -cf UTF-8 -t ASCII//TRANSLIT | tr -d '[:punct:]' | tr '[:upper:]' '[:lower:]' | tr ' ' '-' | sed "s/-\+/-/g;s/\(^-\|-\$\)//g")"

and convert it to something iconv on termix can use?

To me it looks like -cf and -t are the correct flags, perhaps I should use: -c -f -t seperately?

I'll have a look if individual flags would work, but if it doesn't, how should I try to proceed? Do you have any clues that can help perhaps?