abiyani / automate-save-page-as

Automate browser's "Save Page As" operation
Apache License 2.0
167 stars 50 forks source link

issue non-printable ascii character(s) #2

Closed illucent closed 9 years ago

illucent commented 9 years ago

Hi! Downloaded latest save_as... with xdotool-2.20110530.1 and my charset is UTF-8. Great tool but my first output of it is as follows:

save_page_as "www.facebook.com" --destination "/tmp/facebook_home_page.html" ERROR: Either -- destination ('/tmp/facebook_home_page.html') or --suffix ('') contains a non ascii or non-printable ascii character(s). 'xdotool' does not mingle well with non-ascii characters (https://code.google.com/p/semicomplete/issues/detail?id=14).

!!!! Will NOT proceed !!!!

is it a bug or something with my .bashrc ? Thanks

abiyani commented 9 years ago

Hi @illucent

I am not sure why it's failing out for you (I don't see any non-ascii characters in the input). Also, I am unable to reproduce the problem myself (works fine on machines I have access to).

I created a debug branch (debug-for-PR2), can you please checkout it and run save_page_as from there (git fetch, then git checkout debug-for-PR2) ? It will print extra debug info which will be useful for debugging, so please copy paste that after running. (also I made the error non-fatal in debug branch, so it will actually continue after that and hopefully should work fine).

Also can you tell me which OS you are using, and which versions of bash, xdotool, and grep do you have ?

illucent commented 9 years ago

seems to work thanks! "I don't see any non-ascii characters in the input" : me too :) with this version firefox opened with pasted URL output of debug version:

INFO: '/home/illucent/Downloads/saveas' is a directory, will save file inside it with the default name.

----------
DEBUG: In has_non_printable_or_non_ascii('/home/illucent/Downloads/saveas')
Grep output:
/home/illucent/Downloads/saveas

Grep output with -o:
home
illucent
Downloads
saveas

----------
----------
DEBUG: In has_non_printable_or_non_ascii('')
Grep output:

Grep output with -o:

----------
----------
DEBUG INFO
----------
 - has_non_printable_or_non_ascii('/home/illucent/Downloads/saveas') = '1'
 - has_non_printable_or_non_ascii('') = ''
----------

 !!!!! Ignoring this error and continuing (things can go wrong - so please keep an eye on it!) !!!!!
^C
abiyani commented 9 years ago

I wonder what version (or build) of grep are you using, because the pattern '[^ -~]\+' seem to match all characters in path (except /) - weird.

Anyway, for the workaround you can continue to use the "debug" version, and remove the debug statements from it (if they bother you). But please remember not to provide any "unicode" characters in destination directory and suffix.

illucent commented 9 years ago

grep (GNU grep) 2.14