Hello list!
Replying to myself:
> I wrote:
>
> > On intranet at work, there sometimes happens to be unicode (UTF-8)
> > characters such as a Norwegian ø in the filename. With lynx I can
> > retrieve these files, but not with elinks. Is there something I can do
> > to get elinks work also with these URLs?
>
> Let me describe the problem some more:
>
> - I'm using text console only from a Fedora system, with charset
> iso-8859-1. (Dont't think that that matter.)
>
> - I use Elinks 0.13.GIT with ECMAScript (SpiderMonkey) built in.
>
> - The intranet solution is based on Microsoft SharePoint 2010.
>
> - Some files that I want to download, such as pdf or docx has UTF-8
> characters in their file names, e.g. \303\270 as Will mentioned
> (thank you). When selecting such a link, Elinks asks me if I want to
> save the file, and I save it. The file content, however, is only
> this line: 404 NOT FOUND
>
> - The file content is preserved if I use Lynx to download and save the
> file.
Thanks to Witold Filipczyk, who replyed in a private email, the problem
is now solved by the following solution:
- Compiling Elinks with python support, e.g. add --with-python to the
configure script. To avoid some errors at runtime, I had to also add
--sysconfdir=/etc/elinks.
- Add to ~/.elinks/hooks.py
----------
import urllib
def follow_url_hook(url):
"""Rewrite a URL for a link that's about to be followed.
This function should return a string containing a URL for ELinks to
follow, or an empty string if no URL should be followed, or None if
ELinks should follow the original URL.
Arguments:
url -- The URL of the link.
"""
url2 = urllib.quote(url, safe=':~/&%,#+-_=;?')
f = open("/home/user/.elinks/log.txt", "a")
f.write("%s %s\n" % (url, url2))
f.close()
return url2
----------
Thanks and regards,
Lars
_______________________________________________
elinks-users mailing list
[email protected]
http://linuxfromscratch.org/mailman/listinfo/elinks-users