Support : Knowledge base

Knowledge Base

Welcome to OPAL-RT’s Knowledge Base

OPAL-RT offers a repository of support information for optimal use of its technology.

Loading…

Please note that OPAL-RT knowledge base is not fully optimized for mobile platforms.

For optimal experience, use a desktop computer.

Reference Number: AA-01946// Views: AA-01946// Created: 2020-09-15 21:25:53// Last Updated: 2020-09-15 21:33:50
HowTo
RT-LAB Python API: How to change the encoding for using Japanese characters in a *.py file


When trying to use Japanese characters a *.py file in RT-LAB, we must change the encoding to UTF-8  (the default encoding is CP1252)

The encoding can be changed easily by following these steps:

  1. If the *.py file already contains Japanese characters, please delete them and then save the *.py file.

  2. Click anywhere in the Editor window and press Alt+Enter. The "Properties" window will open up now.

  3. In the "Text File Encoding" option, click on "Other"

  4. From the drop down, please select "UTF-8" option, and then save the *.py file.



  5. Type the Japanese text that you want in the *.py file.

  6. Add this line at the top of your code:

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

  7. Save the *.py file again and now it's ready to be run.