Search code examples
revitpythonshellpyrevit

Using french characters with pyRevit or RPS


I'd like to print dialogs in french using pyRevit scripts. As soon as I include an accent like "ê" in my code, the pyRevit script doesn't even execute.

But if I do for instance print "être" in RevitPythonShell, no problem.

Why? Why the different treatment, and can it be handeled with pyRevit?

Thanks a lot, Arnaud.


Solution

  • It is all about encoding and decoding. I reccommend you to read this nice article on the subject : http://sametmax.com/lencoding-en-python-une-bonne-fois-pour-toute/ You should prefix all your scripts with : # coding: utf8

    # coding: utf8
    
    __title__ = "TextEncoding"
    
    print("être")
    

    PyRevit output : enter image description here