← Back to team overview

sikuli-driver team mailing list archive

[Bug 1891848] [NEW] UnicodeEncodeError with OCR

 

Public bug reported:

Hi!

I am using Sikulix 2.0.4 on Windows 10 64bit, JAVA 11.

Sometimes when doing OCR with Reg.text(), following error occurs with
the resulting string:

[error] UnicodeEncodeError ( 'ascii' codec can't encode character u'\u201a' in position 0: ordinal not in range(128) )
[error] --- Traceback --- error source first

my workaround is to use this function to correct the string:

def ExtractAlphanumeric(InputString):
    from string import ascii_letters, digits
    return "".join([ch for ch in InputString if ch in (ascii_letters + digits +" ()*")])


I still have the feeling, that the error should not occur in first place.
REgards
Michael

** Affects: sikuli
     Importance: Undecided
         Status: New

-- 
You received this bug notification because you are a member of Sikuli
Drivers, which is subscribed to Sikuli.
https://bugs.launchpad.net/bugs/1891848

Title:
  UnicodeEncodeError with OCR

Status in Sikuli:
  New

Bug description:
  Hi!

  I am using Sikulix 2.0.4 on Windows 10 64bit, JAVA 11.

  Sometimes when doing OCR with Reg.text(), following error occurs with
  the resulting string:

  [error] UnicodeEncodeError ( 'ascii' codec can't encode character u'\u201a' in position 0: ordinal not in range(128) )
  [error] --- Traceback --- error source first

  my workaround is to use this function to correct the string:

  def ExtractAlphanumeric(InputString):
      from string import ascii_letters, digits
      return "".join([ch for ch in InputString if ch in (ascii_letters + digits +" ()*")])

  
  I still have the feeling, that the error should not occur in first place.
  REgards
  Michael

To manage notifications about this bug go to:
https://bugs.launchpad.net/sikuli/+bug/1891848/+subscriptions


Follow ups