AnsweredAssumed Answered

Using Insert from URL with UTF-16 File

Question asked by DoomSolutions on May 12, 2018
Latest reply on May 14, 2018 by DoomSolutions

Hi, I have a UTF-16le encoded text file, and I'd like to use "Insert from URL" to insert the contents of it into a variable with the correct formatting so I can parse the data in a script. 


My current workflow involves importing the text file into a temp table so every line is a new record and then using the List function to store everything in a variable to parse.  This works totally fine, but I'd like to simply the process by just directly reading the contents and losing the temp table.  Insert from URL seemed like a logical choice.


I'm able to insert the file's contents without issue, but it's adding hidden line returns.  I know Insert from URL only supports UTF-8, so I somehow have to convert it to that first, but I'm having trouble figuring out the proper steps.  I do not want to use plugins, and ideally only use variables, but it seems like a global container or two may be required, which is at least better than a helper table.


I looked into cURL's "--FM-text-encoding," but that doesn't seem to help, so I'm trying to use the TextEncode function, but I'm having trouble figuring out how it works or overcomplicating the process.


What's the correct workflow for storing the contents of a UTF-16 file in a variable using Insert from URL?  Thanks in advance.