← Back to team overview

sikuli-driver team mailing list archive

[Bug 1891848] Re: Jython scripting: UnicodeEncodeError with OCR --- not a bug, it's a feature

 

** Summary changed:

- UnicodeEncodeError with OCR
+ Jython scripting: UnicodeEncodeError with OCR --- not a bug, it's a feature

-- 
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:
  Jython scripting: UnicodeEncodeError with OCR --- not a bug, it's a
  feature

Status in Sikuli:
  Confirmed

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


References