听起来像编码的问题。OutputToString 可以指定字符集。比如:

set tSC=xmldoc.SetValueAt($C(36190),"orderperson","set","")
write xmldoc.OutputToString("C(utf-8)")

加密后还需要base64编码

set b64encoded = $System.Encryption.Base64Encode(sha1Hash)