我试图通过 localhost:9000 通过 XML HTTP 从 Tally ERP 9 导出数据。我正在获取带有 ASCII 数据的 XML 文件。这会导致许多带有“?”的符号。像卢比符号和欧元符号。有没有办法以 Unicode 格式导出数据?使用的 POC 是
import httplib
c=httplib.HTTPConnection('localhost:9000')
headers = {"Content-type": "text/xml;charset=UTF-8", "Accept": "text/xml"}
params = """<ENVELOPE>
<HEADER>
<TALLYREQUEST>Export Data</TALLYREQUEST>
</HEADER>
<BODY>
<EXPORTDATA>
<REQUESTDESC>
<REPORTNAME>List of Accounts</REPORTNAME>
<STATICVARIABLES>
<SVEXPORTFORMAT>$$SysName:XML</SVEXPORTFORMAT>
<ACCOUNTTYPE>Ledgers</ACCOUNTTYPE>
<ENCODINGTYPE>UNICODE</ENCODINGTYPE>
</STATICVARIABLES>
</REQUESTDESC>
</EXPORTDATA>
</BODY>
</ENVELOPE>
"""
c.request("POST", "/", params, headers)
r=c.getresponse().read()
fl=file("d:/xtemp.xml","w")
fl.write(r)
fl.close()