cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

Community Tip - You can subscribe to a forum, label or individual post and receive email notifications when someone posts a new topic or reply. Learn more! X

Encoding of uploaded files

drichter
15-Moonstone

Encoding of uploaded files

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?

3 REPLIES 3
supandey
19-Tanzanite
(To:drichter)

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.

drichter
15-Moonstone
(To:supandey)

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.

supandey
19-Tanzanite
(To:drichter)

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

Announcements


Top Tags