I have a stax job as shown below.

<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!DOCTYPE stax SYSTEM "stax.dtd">
<stax>
<defaultcall function="main"/>
<function name="main">
<function-map-args>
<function-optional-arg name="node" default="'local'">
Target node
</function-optional-arg>
</function-map-args>
 <sequence>
<message log="1">'Get WMIC version'</message>
<process name="'Version'">
<location>node</location>
<command>
'wmic datafile c:\\\\windows\\\\system32\\\\cmd.exe get version'
</command>
<stdout mode="'replace'" >'C:/console.txt'</stdout>
<stderr mode="'stdout'"/>
<returnstdout/>
<focus mode="'minimized'"/>
</process>
<message log="1">STAXResult</message>
<script>
import codecs
build_number =
codecs.utf_16_le_decode(STAXResult[0][1][2:-1],'ignore')[0].split('\r\n')[1].strip()
print(build_number)
</script>
<message log="1">'version: %s'%(build_number)</message>
</sequence>
</function>
</stax>

The issue is that STAXResult shows incorrect values for the first 2 bytes
(FFEE - BOM for UTF16LE). See below for the output from STAXMon

 20130801-21:41:03 [[0, u'\xa0\u25a0V\x00e\x00r\x00s\x00i\x00o\x00n\x00
\x00 \x00 \x00 \x00 \x00 \x00 \x00 \x00
\x00\r\x00\n\x006\x00.\x002\x00.\x009\x002\x000\x000\x00.\x001\x006\x003\x008\x004\x00
\x00 \x00\r\x00\n\x00']]

What I have to do was remove the first two bytes and then decode it and
ignore any errors. The solution works but it feels like it can be improved.

My question is. Is there a switch so that process element handles unicode
output from the console?

-ts
------------------------------------------------------------------------------
Get your SQL database under version control now!
Version control is standard for application code, but databases havent 
caught up. So what steps can you take to put your SQL databases under 
version control? Why should you start doing it? Read more to find out.
http://pubads.g.doubleclick.net/gampad/clk?id=49501711&iu=/4140/ostg.clktrk
_______________________________________________
staf-users mailing list
staf-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/staf-users

Reply via email to