utf-16 to utf-8

Post Reply
pp
Newbie
Posts: 4
Joined: Thu Oct 03, 2013 3:52 pm

utf-16 to utf-8

Post by pp »

How to convert a textfile from utf-16 to utf-8 inside switch with the execute command.

In the terminal it's working:

iconv -f utf-16 -t utf-8 input_utf16.txt > output_utf8.txt



How to set the paths in switch, see screenshot...



(and maybe some tips on setting the 'output' and 'fail if exit code is')









freddyp
Advanced member
Posts: 413
Joined: Thu Feb 09, 2012 3:53 pm

utf-16 to utf-8

Post by freddyp »

"%1"/_[Job.etc. is wrong. %1 is a complete path to the input file, so "%1" is all you need.



As the command generates output, having "Output" set to "None" is also not going to work. I recommend choosing "Updated input job" and in the "Arguments" you then simply have:

-f utf-16 -t utf-8 "%1"



If you want to rename the file, do that with a separate "Rename job" afterwards.



Freddy
pp
Newbie
Posts: 4
Joined: Thu Oct 03, 2013 3:52 pm

utf-16 to utf-8

Post by pp »

The problem is iconv first creates the output file and can't write over the input file. So i have to use a > and i think a %2 or %3 for the output-path (and filename?) to write to.

And i don't get Hard-coded paths to work...
freddyp
Advanced member
Posts: 413
Joined: Thu Feb 09, 2012 3:53 pm

utf-16 to utf-8

Post by freddyp »

In that case add > "%2" and choose "File at path" as "Output"
pp
Newbie
Posts: 4
Joined: Thu Oct 03, 2013 3:52 pm

utf-16 to utf-8

Post by pp »

In that case the file is disappearing...

(with copy input path: no)

when fail exit code set to Nonzero it goes into the Problem jobs



Error message:

04.10.2013 15:10:59.853 error Execute command

Operation: Job failed because outcode is nonzero, outcode = [%1]

Argument: 1

Flow: utf16 naar utf8

Element: iconv

Ticket: 00K62

File: _00K62_16.txt
pp
Newbie
Posts: 4
Joined: Thu Oct 03, 2013 3:52 pm

utf-16 to utf-8

Post by pp »

In the log: File '_00K68_16.txt' was sent to null; it will be deleted when the entry point finishes



and not the first in the forum: execute command to launch python



I think it's the same problem... "%1" > "%2"



it's in the > character
dkelly
TOP CONTRIBUTOR
Posts: 628
Joined: Mon Nov 29, 2010 8:45 pm
Location: Alpharetta GA USA
Contact:

utf-16 to utf-8

Post by dkelly »

You will need to wrap the command in a shell or batch script.



iconv returns 0 if successful and 1 if not.
Post Reply