Skip to main content
Question

Unicode for Python Caller

  • May 8, 2019
  • 4 replies
  • 26 views

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?

This post is closed to further activity.
It may be an old question, an answered question, an implemented idea, or a notification-only post.
Please check post dates before relying on any information in a question or answer.
For follow-up or related questions, please post a new question or idea.
If there is a genuine update to be made, please contact us and request that the post is reopened.

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+7
  • Contributor
  • May 8, 2019

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


  • May 8, 2019

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

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.