Quantcast
Channel: Scripting - McNeel Forum
Viewing all articles
Browse latest Browse all 5938

Rhino Python locale decoding

$
0
0

@galinette wrote:

Dear all,

I need to get object names and to convert them to UTF-8 for XML export.

By the past, I had used this for converting rhino names to UTF-8:

xmlString = rhinoString.decode(locale.getpreferredencoding()).encode('utf-8')

But recently, I found that the script does not work with non ascii characters, and that locale.getpreferredencoding() returns 'ascii' while rhino definitely uses another encoding, raising an exception in decode(). Since I'm almost sure that this has worked by the past, it seems some changes in Rhino IronPython have broken the script.

1) Do rhino strings in python have a fixed encoding we could use in decode() without trying to detect the locale?
2) If not, what is the proper way to detect the locale?

Thanks in advance

Best regards,

Etienne

Posts: 2

Participants: 2

Read full topic


Viewing all articles
Browse latest Browse all 5938

Trending Articles