Have you tried using the unicode characters for the match?  The following 
section in the STAF FAQ has an example:

http://staf.sourceforge.net/current/STAFFAQ.htm#d0e768
"2.7.2. How do I specify non-ASCII characters in a STAF request or STAX 
job?"
 
Thanks, 
David 

David Bender 
STAF/STAX Development 
IBM Software Group, WPLC 
 
11501 Burnet Rd. 
Bldg. 903-5B002 
Austin, TX 78758-3400 
 
Phone (T/L): 1-512-286-5315 (363-5315) 
ITN: 23635315 
Email: bda...@us.ibm.com 
 





Li Wiston <wiston.l...@gmail.com> 
07/09/2009 04:50 AM

To
staf-users@lists.sourceforge.net
cc

Subject
[staf-users] How do I match the chinese characters for STAXResult 
variable?






Hi, guys
 
On every machine installed STAF, there are the Chinese OS setup. So I have 
to check the chinese string returned after 
execute the STAF/STAX command. For instanse, I need to check if the 
targeted machine install the svn and get the expeced response,
 I have to try type "SVN help" and then check the STAX result. However, I 
fail to match the chinese characters for STAXResult variable, still the 
english string always work fine.
 
Can anybody help me make the command below work well ? thanks in advance.
 
m = re.match(r'.*用法.*', ''.join(STAXResult[0][1].split()))
 
 
The STAXResut text is: 用法:svn<subcommand>[options][args]Subversion命令行
客户端,版本1.6.3。使用“svnhelp<subcommand>”显示子命令的帮助信息。使用
“svn--version”查看程序的版本号和版本库访问模块,或者使用
“svn--version--quiet”只查看程序的版本号。大多数的子命令可接受文件或目录参
数,对目录进行递归处理。如果没有指定参数,默认对当前目录(包含当前目录)递归
处理。可用的子命令
:addblame(praise,annotate,ann)catchangelist(cl)checkout(co)cleanupcommit(ci)copy(cp)delete(del,remove,rm)diff(di)exporthelp(?,h)importinfolist(ls)locklogmergemergeinfomkdirmove(mv,rename,ren)propdel(pdel,pd)propedit(pedit,pe)propget(pget,pg)proplist(plist,pl)propset(pset,ps)resolveresolvedrevertstatus(stat,st)switch(sw)unlockupdate(up)Subversion
是版本控制工具。欲取得详细资料,请参阅http://subversion.tigris.org/
 
 
 
 
 
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!DOCTYPE stax SYSTEM "stax.dtd">
<stax>
<defaultcall function="main"/>
<function name="main">
<sequence> 
<!--Ping Task-->
 
<process>
  <location>'local'</location>
  <command>'svn help'</command>
  <returnstdout/>
</process> 

<log level="'error'">
'Process failed with RC=%s, Result=%s' % (RC, STAXResult[0][1])
</log>

<script>
import re
m = re.match(r'.*svnhelp.*', ''.join(STAXResult[0][1].split()))
f = open("d:\stdout.txt","w")
f.writelines(''.join(STAXResult[0][1].split()))
f.writelines('\n')
if m:s
    f.writelines('find') 
else:
    f.writelines('unfind') 
 
f.close()
</script>

 
</sequence> 
</function>
</stax>
------------------------------------------------------------------------------
Enter the BlackBerry Developer Challenge 
This is your chance to win up to $100,000 in prizes! For a limited time, 
vendors submitting new applications to BlackBerry App World(TM) will have
the opportunity to enter the BlackBerry Developer Challenge. See full 
prize 
details at: http://p.sf.net/sfu/Challenge
_______________________________________________
staf-users mailing list
staf-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/staf-users


------------------------------------------------------------------------------
Enter the BlackBerry Developer Challenge  
This is your chance to win up to $100,000 in prizes! For a limited time, 
vendors submitting new applications to BlackBerry App World(TM) will have
the opportunity to enter the BlackBerry Developer Challenge. See full prize  
details at: http://p.sf.net/sfu/Challenge
_______________________________________________
staf-users mailing list
staf-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/staf-users

Reply via email to