Skip to main content
1-Visitor
May 4, 2018
Question

Encoding of uploaded files

  • May 4, 2018
  • 1 reply
  • 1366 views

Hi,

 

i have a service which works with uploaded csv files. For a test a customer send me csv files with utf-16 encoding. My service have some trouble with this encoding. Can I recode files in thingworx?

1 reply

5-Regular Member
May 16, 2018

Hi @drichter could you please add more information on what sort of service / method you are working with. Are you parsing it with any specific encoding? I'm not entirely sure if the issue you are running into is because of the Tomcat's setting which is set to UTF-8 as recommended in the installation guide for ThingWorx. Any possibility to also attach test csv file of the type you receive from your customer?

 

Anyhow, will more info I could reach out to concerned team for help on this.

drichter1-VisitorAuthor
1-Visitor
May 28, 2018

I made a service which try to parse the csv file. It split the csv into a array of lines:

lines = csvcontent.split('\n');

Then I iterate through all this lines and parse the elements:

elements = singleLine.split(',');

If you what the conent of this element or lines I get many non-printable characters because thingworx try to interpret a utf-16 file as a utf-8 file.

 

To show what its look like:

utf16-is-crap.PNG

 

The problem some files of the customer are utf-8 and some utf-16.

5-Regular Member
May 29, 2018

@drichter thanks for adding the detail. I'm looking into it.