惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

Google DeepMind News
Google DeepMind News
N
Netflix TechBlog - Medium
The Register - Security
The Register - Security
C
Cybersecurity and Infrastructure Security Agency CISA
H
Hackread – Cybersecurity News, Data Breaches, AI and More
The Hacker News
The Hacker News
P
Proofpoint News Feed
Project Zero
Project Zero
The GitHub Blog
The GitHub Blog
The Last Watchdog
The Last Watchdog
F
Fortinet All Blogs
S
Schneier on Security
Help Net Security
Help Net Security
Security Archives - TechRepublic
Security Archives - TechRepublic
C
Check Point Blog
让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
P
Proofpoint News Feed
I
InfoQ
T
The Blog of Author Tim Ferriss
Cisco Talos Blog
Cisco Talos Blog
Stack Overflow Blog
Stack Overflow Blog
T
Troy Hunt's Blog
人人都是产品经理
人人都是产品经理
T
Threatpost
www.infosecurity-magazine.com
www.infosecurity-magazine.com
C
Cyber Attacks, Cyber Crime and Cyber Security
雷峰网
雷峰网
cs.AI updates on arXiv.org
cs.AI updates on arXiv.org
Threat Intelligence Blog | Flashpoint
Threat Intelligence Blog | Flashpoint
爱范儿
爱范儿
Forbes - Security
Forbes - Security
Vercel News
Vercel News
S
Security Affairs
美团技术团队
P
Privacy & Cybersecurity Law Blog
N
News and Events Feed by Topic
Cyberwarzone
Cyberwarzone
Recent Commits to openclaw:main
Recent Commits to openclaw:main
Jina AI
Jina AI
Spread Privacy
Spread Privacy
Attack and Defense Labs
Attack and Defense Labs
IT之家
IT之家
U
Unit 42
Recorded Future
Recorded Future
W
WeLiveSecurity
PCI Perspectives
PCI Perspectives
P
Palo Alto Networks Blog
H
Hacker News: Front Page
S
Security @ Cisco Blogs
博客园 - 【当耐特】

博客园 - Render

数据绑定表达与javascript字符串连用 - Render - 博客园 手工删除打印任务 burrow在某些项目使用中报"控件包含代码块(即 <% ... %>),因此无法修改控件集合" - Render httpModules remove does not work in a folder or virtual directory 事件触发型ActiveX放置在网页中的部分思考 Javascript中文字符串处理额外注意事项 - Render - 博客园 Arc Catalog重建索引时报错:ORA-02298: 无法验证 (SDE.A18_FK1) - 未找到父项关键字 (A18_FK1) 指定web.config让httphandler处理某目录及子目录下所有文件 - Render - 博客园 windows命令行里取得年-月-日-时-分-秒的办法 - Render - 博客园 网站复杂信息自动录入处理 css中url的路径含义 ORACLE Transparent Gateway透明网关安装配置小问题 使用OLEDB访问ACCESS的几点经验 [转载]ARCIMS 9.2 [ERR0134]错误解决方法 ORACLE 大数据表Update处理 PL/SQL developer的HomeEnd问题(转载) ArcSDE9.0对Oracle初始化参数的要求 在SDE中创建dataset时"Fail to Create, Cann't found spatial referrence entry"错 处理Oralce中非法的日期值
ARCIMS Serverlet Connector查询属性,当属性为中文时乱码处理 - Render
Render · 2008-10-10 · via 博客园 - Render

问题救助描述:
我用AXL构造了一个SPATIALQUERY,返回字段中有一字段值是中文的(如BUILDLOC),但是我取得的是乱码。我查询的代码是:
                Dim arcimsRequest As HttpWebRequest = CType(WebRequest.Create(_serverURL), HttpWebRequest)
                arcimsRequest.Method = "POST"
                arcimsRequest.ContentType = "application/x-www-form-urlencoded"
                arcimsRequest.Timeout = _requestTimeout

                    Dim postWriter As StreamWriter = New StreamWriter(arcimsRequest.GetRequestStream())

                    postWriter.Write("<?xml version='1.0' encoding='UTF-8'?>")
                    postWriter.Write("<ARCXML version='1.1'>")
                    postWriter.Write(request.AXL)
                    postWriter.Write("</ARCXML>")
                    postWriter.Flush()
                    postWriter.Close()
                    arcimsRequest.Timeout = 100000   '100秒
                    Dim arcimsResponse As HttpWebResponse = CType(arcimsRequest.GetResponse(), HttpWebResponse)

                    Dim sr As StreamReader = New StreamReader(arcimsResponse.GetResponseStream, System.Text.Encoding.Default)
                    Try
                        response = sr.ReadToEnd()
                    Finally
                        sr.Dispose()
                    End Try

查了其返回的XML中头一句中有"encoding='GBK'"

我的环境是:WIN2003 SERVER 中文版,ORA 9i ZHS16GBK,IMS 9.2
且使用BUILDLOC显示的中文标注是对的。

另:在请求中,可不可以设置ARCIMS返回的XML的encoding?

问题解决方案:
经过2天的测试,发现竟然是因为ARCIMS92 Serverlet Connector对请求的AXL中单引号处理出错所致!原来这些代码在IMS90中是运行好好的。
最后处理:
                    Dim strAXL As String = request.AXL
                    If Not String.IsNullOrEmpty(strAXL) Then 'XML正则化,可以防止返回因请求导致的中文乱码

                        Dim doc As XmlDocument = New XmlDocument()
                        doc.LoadXml(strAXL)
                        If doc.DocumentElement Is Nothing Then
                            Throw New NullReferenceException("Node not set to instance of an object.  Can not parse AxlFragment.")
                        End If
                        strAXL = doc.DocumentElement.OuterXml
                    End If

                    Dim strRequest As String = "<?xml version=""1.0"" encoding=""UTF-8""?><ARCXML version=""1.1"">" & strAXL & "</ARCXML>"
让XmlDocument去正则化一次请求的AXL,这样就正常了。