0

I have the following code:

# -*- coding: utf-8 -*-
import splinter
import urllib

browser = splinter.Browser('firefox')

miss = ("rĂșin",)

for i in miss:
    browser.visit(link)
    browser.fill('word', i)

Which gives me the error:

UnicodeDecodeError: 'ascii' codec can't decode byte 0xc3 in position 1: ordinal not in range(128)

How can I resolve this issue?

Nicolas Cortot
  • 6,591
  • 34
  • 44
Baz
  • 12,713
  • 38
  • 145
  • 268

1 Answers1

1

Use an actual unicode value:

miss = (u"rĂșin",)

Note the u before the string literal.

Python otherwise will try to coerce the bytestring to unicode implicitly, using the default codec (ASCII).

Martijn Pieters
  • 1,048,767
  • 296
  • 4,058
  • 3,343