Jan-10-2020, 09:33 AM
(Jan-09-2020, 05:31 PM)vivekagrey Wrote: I want to show a web page(actually a google map) in tkinter
Error:UnicodeDecodeError: 'utf-8' codec can't decode byte 0xa0 in position 12619: invalid start byte
The encoding is iso-8859-1, better known as latin1.
Not all webpages are encoded with utf8. You need to get this information
from headers or you just use the requests module.
import urllib.request from tk_html_widgets import HTMLLabel from tkinter import Tk root = Tk() text = HTMLLabel(root) text.pack(fill="both", expand=True) req = urllib.request.urlopen("https://www.google.com" ) encoding = req.headers.get_content_charset() text.set_html(req.read().decode(encoding)) text.fit_height() root.mainloop()But this is not the complete solution.
I guess you need something which is also able to parse and execute javascript.
If you run this code, you see all JavaScripts in clear text.
Almost dead, but too lazy to die: https://sourceserver.info
All humans together. We don't need politicians!
All humans together. We don't need politicians!