Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

scraped text in Russian encoding python

from bs4 import BeautifulSoup
import requests

source = requests.get('https://time.mk/')  # don't convert to text just yet

# print(source.encoding)
# prints out ISO-8859-1

source.encoding = 'utf-8'  # override encoding manually

soup = BeautifulSoup(source.text, 'lxml')  # this will now decode utf-8 correctly
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #scraped #text #Russian #encoding #python
ADD COMMENT
Topic
Name
4+4 =