Skip to main content
16-Pearl
Jan 10, 2025 3:12 PM UTC
Solved

problem with LoadText

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

iguerraAnswer
16-Pearl
Jan 13, 2025 12:13 PM UTC

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

 

 

 

 

4 replies

5-Regular Member
Jan 10, 2025 4:50 PM UTC

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.

Translate
19-Tanzanite
Jan 13, 2025 7:50 AM UTC

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?
Translate
iguerra16-PearlAuthor
16-Pearl
Jan 13, 2025 9:43 AM UTC

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)

 

Translate
iguerra16-PearlAuthorAnswer
16-Pearl
Jan 13, 2025 12:13 PM UTC

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

 

 

 

 

Translate