Non ascii character in script


#1

Hi, I just added this line to my script:
#Script by Jørgen Holo

And Python was not so thrilled to see the “ø” in there.

Just wanted to let you know.


(Menno Deij - van Rijswijk) #2

You can set a UTF-8 header in the source code - hopefully this will solve your problem
first line should read

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

see also:


#3

Thanks, that can be handy for later referance if this won’t be “fixed” in the editor.


(Steve Baer) #4

Do you have a suggestion for a good way to “fix” this in the editor? The best I could come up with is a more meaningful suggestion of what to change when the editor runs into this problem. I don’t want to automatically adjust user’s scripts and it is a good thing for people to learn since it applies to all implementations of python.


#5

A good warning is a great start as I have no problem calling my self “Jorgen” :wink:

I can imagine it might be worse for those who write scripts for users of native languages, who need similar letters. Coding a text with +chr(xx)+ for each uniqe letter might be a pain. But all my scripts are in English, so I don’t have that need, at least not now.


(Steve Baer) #6

Ok; I’ve logged this as a feature to implement in the future.
http://mcneel.myjetbrains.com/youtrack/issue/RH-23424 (not currently visible to the public)

Thanks