cancel
Showing results for 
Search instead for 
Did you mean: 

Unable to process text read from file

JacobChristens1
Level 2
Hi Experts

I am trying to read the settings file for OneDrive (%LocalAppData%\Microsoft\OneDrive\settings\Business1\{GUID}.ini) with the Read All Text From File activity.

I can see that it returns a result of 3,238 characters. But when I try open the variable I can only see the very first character. I have also tried to use the Read Lines From File which returns a collection. The collection if populated as expected but when I open the collection the text disappears when I click the row.

When I open the file in Notepad I can see that it is using UTF-16 LE  encoding. Also the content is only 1,619 characters (half of what Blue Prism interprets).

My guess is that it is due to the encoding - any ideas on how to sort this out?

------------------------------
Jacob Christensen
IT Consultant
------------------------------
1 BEST ANSWER

Helpful Answers

ewilson
Staff
Staff
Hi @Jacob Christensen,

​Try changing the definition of the Read Lines action Code stage such that it specifies the encoding. Really, you'd want to make a copy of the action and change the copy, but changing the original is a quick and easy test. A value of Encoding.Unicode results in UTF 16 Little Endian.

12609.png
Cheers,

------------------------------
Eric Wilson
Director, Integrations and Enablement
Blue Prism Digital Exchange
------------------------------

View answer in original post

2 REPLIES 2

ewilson
Staff
Staff
Hi @Jacob Christensen,

​Try changing the definition of the Read Lines action Code stage such that it specifies the encoding. Really, you'd want to make a copy of the action and change the copy, but changing the original is a quick and easy test. A value of Encoding.Unicode results in UTF 16 Little Endian.

12609.png
Cheers,

------------------------------
Eric Wilson
Director, Integrations and Enablement
Blue Prism Digital Exchange
------------------------------

Thanks Eric - that sorted out the problem. I copied the Read All Text From File activity and added the System.Text.Encoding.Unicode to the StreamReader part and it works fine.

------------------------------
Jacob Christensen
IT Consultant
------------------------------