0

I am using moviepy to make some videos. I am using Beautifulsoup to scrape the text.

I need a Russian text clip to appear on the screen with the video. My code works fine for languages like English and Esperanto.

How can I solve this problem?

After the scrape, the type is class 'bs4.element.NavigableString'

This is what I have tried so far.

Attempt one:

t = ''.join(t.split()) # remove extra whitespaces
t = t.encode("utf-8")

The type is class 'str' and the text prints to the terminal perfectly but the Russian letters on the text clip within the video are represented by question marks.

Attempt two:

t = ''.join(t.split()) # remove extra whitespaces
t = unicode(tag.string) # recommended by bs4

Prints to terminal perfectly but when rendering I get this error: UnicodeEncodeError: 'ascii' codec can't encode characters in position...

Attempt three:

t = ''.join(t.split()) # remove extra whitespaces
t = unicode(t)

Prints to terminal perfectly but when rendering I get this error: UnicodeEncodeError: 'ascii' codec can't encode characters in position...

Attempt four:

t = ''.join(t.split()) # remove extra whitespaces
t = unicode(t, "utf-8")

Doesn't even reach the rendering stage - prints to terminal perfectly but I get this error: TypeError: decoding Unicode is not supported.

0 Answers0