Skip to main content
Question

Unicode for Python Caller


I have a unicode string that looks like:

Lat: 49° 16.578', Lng: -123° 7.3'

In a standalone Python script I can find the unicode characters by putting this at the top of my script:

# -*- coding: utf-8 -*-

However, this doesn't work in the PythonCaller. Is there a way to do this?

4 replies

david_r
Celebrity
  • May 8, 2019

Maybe not the answer you're looking for, but switch your workspace to use Python 3 if you can. Unicode is much, much simpler then.


giosp
Contributor
Forum|alt.badge.img+6
  • Contributor
  • May 8, 2019

Hi, try this when you print the string text.encode('utf-8')


  • May 8, 2019
giosp wrote:

Hi, try this when you print the string text.encode('utf-8')

No, I get: 'ascii' codec can't decode byte 0xc2 in position 7: ordinal not in range(128)

 


  • May 8, 2019
david_r wrote:

Maybe not the answer you're looking for, but switch your workspace to use Python 3 if you can. Unicode is much, much simpler then.

Looks like Python 3 is going to do it. No conversion needed, it just understands the unicode characters.


Cookie policy

We use cookies to enhance and personalize your experience. If you accept you agree to our full cookie policy. Learn more about our cookies.

 
Cookie settings