Text -> Extract does not support non-ASCII characters

Migrated from: https://bugs.launchpad.net/inkscape/+bug/1810626

Steps to reproduce:

  1. Select the group in the attached sample file.
  2. Click Extensions -> Text -> Extract.

Sample file: text-extract-unicode-bug.svg

What happened?

The following error appears:

Traceback (most recent call last):
  File "text_extract.py", line 107, in <module>
    Extract().run()
  File "/usr/share/inkscape/extensions/inkex/base.py", line 89, in run
    ret = self.effect()
  File "text_extract.py", line 92, in effect
    self.recurse(copy.deepcopy(node))
  File "text_extract.py", line 100, in recurse
    inkex.errormsg(etree.tostring(node, method='text').strip())
  File "src/lxml/etree.pyx", line 3351, in lxml.etree.tostring
  File "src/lxml/serializer.pxi", line 103, in lxml.etree._tostring
  File "src/lxml/serializer.pxi", line 75, in lxml.etree._textToString
UnicodeEncodeError: 'ascii' codec can't encode character u'\xe9' in position 17: ordinal not in range(128)

What should have happened?

The 'additional data' dialog should appear with the following text in it:

Café

Inkscape Version and Operating System:

  • Inkscape Version: 1.0alpha (746904b607, 2019-05-10)
  • Operating System: openSUSE Tumbleweed
  • Operating System version: 20190509

This also occurs with Inkscape 0.92.4 and earlier releases.