Convert multiple text files from Unicode to ANSI


I have used the “export schedule” Dynamo script shared in this website to export my Revit schedules to text files. However, I would like expand the script to further convert the text files format from Unicode to ANSI with Python script.
Is it possible? Can anyone help me on this?

Thank you.


Please sum up first some infos out of your preliminary researches that make clear that Dynamo is the best tool for this task:

1 Like

Hi Yna_Db,

Thanks for the reply. My current solution is batch file too, similar to the one that you shared with me.
However, I still hope that I can combine the procedure in a Dynamo script to ease the work.

Thank you again for the prompt reply. :slight_smile:


Please send also related researches links, you will easily find online resources and will need to make a first proposal:

Hi Yna_Db,

Thanks for the reply. I have try the Python script with “import io”. Unfortunately I get warning message as below:
Warning: IronPythonEvaluator.EvaluateIronPythonScript operation failed.
Traceback (most recent call last):
File “”, line 1, in
ImportError: No module named io

I am not sure what caused this. :frowning_face:

You can paste your code here this way:

By doing so, you make it easier for everyone to grasp where the problem lies and what could be the appropriate answer

Hi Yna_Db,

Screenshot of my dynamo script:

Here is the code:

import io

src_path = (IN[0])

with, mode="r", encoding="Unicode") as fd:
    content =
with, mode="w", encoding="ANSI") as fd:

Hope you can help me on this.

Thanks & regards,

Hi guys,

I readed your problems about change enconding in dynamo and would I like to know if you solved this problems if you can help me with it? because I have the same question

I am export my schedules in unicode and I want change to ANSI with python script.

Thank you!

Hi @oliveira.luma,

Unfortunately i am still looking for solution to this problem until today. However, i have just requested for help from Autodesk technical support team. Hopefully they will get back to me with a solution soon. If they do, i will update here.

Thank you.


Thank you so much for reply!

I am waiting for reply with you. But how did you send the question to them? Existy some email or anything like this? Because I can send to them the same question, some times we can get the answer fastest

Just stumbled upon your issue.
In order to import libraries form the IronPython lib you need to add a reference to the location in your python script, so in order to use “io” you should add this line above “import io”:

import sys
sys.path.append("C:\Program Files (x86)\IronPython 2.7\Lib")

Hi @oliveira.luma,

I met one of the Autodesk technical specialists during an event recently. I just verbally told him my issue and passed him my name card. Looking forward to his reply shortly.

Thanks & regards,

Hi @Jonathan.Olesen,

Thanks for your reply. Yes, i noticed about that and added that in my Python script. Unfortunately it’s still not working.

Thank you.


I would like to give it a go, it should very well be possible to do the convertion from unicode to ANSI within python. If you would like me to try please upload a .dyn file, and a sample .rvt file that I can perform the test on. (.rvt file should contain relevant schedules, and .dyn file should contain working graph for “standard” export of schedues incl python script).

Can you Share Your Unicode file?

Hi @Jonathan.Olesen,

That would be great! Thank you very much.
I will upload the files on next Monday, when i back to office.

Thank & regards,

Hi @robert12546358,

I do not have the files with me now. I will upload a sample on the next Monday when i back to office.

FYI, any Revit schedule exported from Revit will be saved in Unicode encoding by default.

Thanks & regards,

Hi @ddd-team,

The script below works :

import sys
sys.path.append(r'C:\Program Files (x86)\IronPython 2.7\Lib')
import codecs

src_path = IN[0]
dst_path = IN[1]

with, 'r', encoding = 'UTF-16') as file:
	lines =  

#write output file
with, 'w', encoding = 'latin-1') as file:

OUT = 0

You can modify it to handle a list of text files or make a custom node with lacing on longest.

1 Like

Hi and happy Friday.

First I found out that Python doesn’t have an ANSI encoding which made me look up what is ANSI.

And it turns out it can be different on different systems.
Other than that what @Alban_de_Chasteigner posted should work :slight_smile:
or even something as simple as that:

Have a great weekend!

Hi, guys, Thanks for reply!

Your tips worked to my documents, but one document for time. However, I have diferents documents and I would like change enconding in the same time of every documents and I tried to do like this:

But It didn’t work :frowning: