lynx -accept_all_cookies $URL -cmd_script=bar.txt
bar.txt:
key <tab> //get to first field
key <tab> //get to second field
key ძ //utf=8 input ძ
key ე //utf=8 input ე
key ბ //utf=8 input ბ
key ნ //utf=8 input ნ
key ა //utf=8 input ა
key <tab> //get to third field
key <tab> //get to fourth field
key <tab> //get to sumbit button
key ^J //click submit and wait for load
key <tab> //get to hyperlink
key ^J //click hyperlink and wait for load
key Q //exit
key y //confirm exit
The above attempt, adapted from this SO question, works fine for Ascii characters but not for Georgian input characters.
Any suggestions?
The characters you want to send are multibyte UTF-8 sequences, and the lynx command script
keycommand only sends a single 8-bit byte. So you have to break the characters into individual bytes and send each byte separately.That's a little annoying; the simplest way to do it might be to use the
-cmd_logoption to create a log file while you type the characters you want to send.However, you can do this with bash:
That bash command is probably a little obscure :-). Here's a quick breakdown:
Unlike C
printf(and others), the shellprintfrepeats its pattern until all arguments have been handled. And, as another idiosyncracy, if the format is numeric (such as%x, which formats its argument in hexadecimal and the corresponding argument starts with a", the number used for the argument is the character code of the second character in the argument (i.e. the one after the").The
sedcommand turns a byte-sequence into a series of arguments with exactly this form; it's important to not quote the command substitution so that the individual substitutions will be treated as separate arguments. That means that the command won't work if$georgiancontains any shell metacharacter, but since all shell metacharacters are simple ascii characters, there won't be any problem provided that every character in$georgianis, in fact, Georgian. (But don't put spaces in the string. They'll get silently dropped.)