How to convert .txt to ANSI encoding

Hello Guys!

I am trying to convert files from any encoding to ANSI like this:

UiPath.Core.Activities.ReadTextFile
and then
UiPath.Core.Activities.WriteTextFile

The last activity has an option called Encoding, which parameters are defined this link [https://activities.uipath.com/docs/supported-character-encoding]

But in the list I’m not finding ANSI encoding, it just says that “If no Byte Order Marks are detected, the system ANSI code page is selected by default.” And I’m writing “” to force it like default but it is not converting it to ANSI, only to UTF-8.

Any idea on how to do it?

Thank you so much!!

@badita :mage::pray:

Hello @MauricioCamposM recently I had the same problem, and found that you can use this code: Windows-1252 , it will work just like the ANSI, when generating a file you will see that the encoding format will be ANSI if you use that code,I refer to this text that I found in stackoverflow.

_ ANSI encoding is a slightly generic term used to refer to the standard code page on a system, usually Windows. It is more properly referred to as Windows-1252 on Western/U.S. systems. (It can represent certain other Windows code pages on other systems.) This is essentially an extension of the ASCII character set in that it includes all the ASCII characters with an additional 128 character codes. This difference is due to the fact that “ANSI” encoding is 8-bit rather than 7-bit as ASCII is (ASCII is almost always encoded nowadays as 8-bit bytes with the MSB set to 0). See the article for an explanation of why this encoding is usually referred to as ANSI.

The name “ANSI” is a misnomer, since it doesn’t correspond to any actual ANSI standard, but the name has stuck. ANSI is not the same as UTF-8._

3 Likes

Thank you so much! I was opening one .txt by one, now I can convert a whole directory to ANSI in 2 secs!

Thank you!

Hi Farnciso, I have a similar scenario where i need to convert it to UNIX ANSI, can you please help with the encoding code for the same?

Thanks! this solved my problem as well.