Quick reference
You can take a look at the following references to get an overview of the code present in this chapter:
soup = BeautifulSoup(html_markup,"lxml",from_encoding="latin-1")
. Here,from_encoding
is used while creatingBeautifulSoup
to specify the document encoding.soup.original_encoding
: This gives the original encoding detected by Beautiful Soup.The output content in specific encoding is listed using the following methods:
soup.prettify()
soup.encode()