1

In my script (written in Sublime Test) I've a comment that reads:

# -*- coding: utf-8 -*-
import unicodedata

# Bööm! Bööm! Shake shake the room!
print u"Bööm! Bööm! Shake shake the room!"

Which works fine in a command prompt window.

However, when dragging and dropping the script into Maya's script editor the same line reads:

# Bööm! Bööm! Shake shake the room!
print u"Bööm! Bööm! Shake shake the room!"

How do I make the comment read as intended?

Ghoul Fool
  • 6,249
  • 10
  • 67
  • 125
  • 1
    BTW having `#!/usr/bin/python` for a maya script is a bit misleading, because your definitely not calling `usr/bin/python` on any system when using maya unless you actually spent a ton of time configuring your system python to be maya python. – joojaa Feb 11 '18 at 09:31
  • @joojaa He he he. Force of habit. I'll remove it. Shebang begone! – Ghoul Fool Feb 11 '18 at 11:46

1 Answers1

2

It's definitely Windows' problem. In macOS El Capital and macOS Sierra it works fine.

import unicodedata
print u"Bööm! Bööm! Shake shake the room!"

#result: Bööm! Bööm! Shake shake the room!

Although it's about different topic, look at this useful SO post: Convert a Unicode string to a string in Python. This post might give you some ideas.

Maybe, you should try this method:

u = u"Bööm! Bööm! Shake shake the room!"
e = u.encode('utf8')
print e

#result: Bööm! Bööm! Shake shake the room!
Andy Jazz
  • 49,178
  • 17
  • 136
  • 220