Skip to main content
16-Pearl
January 10, 2025
Solved

problem with LoadText

  • January 10, 2025
  • 2 replies
  • 1456 views

why when I try to load a particular, very short CSV file (100 bytes) I get this error on application log ?
Execution error in service script [testscript] :: Input length = 3

 

with other files it's OK

Best answer by iguerra

I found that the problem was due to letter "à" (ascii exdended) on the csv text file, and that file was not saves with UTF-8 encoding but ANSI

Note that this happen with TWX 9.6 , in the past I was using TWX 8.5 and it was working fine

 

Now by saving the csv file with UTF-8 encoding, even with the "à" letter, it loads fine with LoadText

Problem solved

 

 

 

 

2 replies

5-Regular Member
January 10, 2025

Take a look at this support article - Article - CS294337 - How to import text, CSV, or Excel data into ThingWorx. Hopefully that can resolve your issue.

19-Tanzanite
January 13, 2025

Hi @iguerra ,

  1. Can you share the content of your testscript service and the ScriptErrorLog.log lines that correspond to that error?
  2. If you're trying to execute LoadText directly on the CSV file, what result will it give?
iguerra16-PearlAuthor
16-Pearl
January 13, 2025

Hello @VladimirRosu_116627 

I'm, using loadText, not trying to import the csv data

// Content: STRING
Content = Things["MyRepository"].LoadText({
	path: 'LDP.csv' /* STRING */
});

It seems the content of this particular file cause problem with that function. Function that is working since lot of time.

It is a text file with 2 rows of text, file is present and correct

 

with another text file works with no problems ... really strange !

 

(sorry unfortunatel I pressed the "accepted as solution" button, but I didn't solved)

 

iguerra16-PearlAuthorAnswer
16-Pearl
January 13, 2025

I found that the problem was due to letter "à" (ascii exdended) on the csv text file, and that file was not saves with UTF-8 encoding but ANSI

Note that this happen with TWX 9.6 , in the past I was using TWX 8.5 and it was working fine

 

Now by saving the csv file with UTF-8 encoding, even with the "à" letter, it loads fine with LoadText

Problem solved