HEXADECIMAL VALUE 0X03 is an invalid character

别说谁变了你拦得住时间么 提交于 2020-01-04 01:58:09

问题


This is the source of a web page

<html lang="pl">
<head>
<meta http-equiv="content-type" content="text/html;charset=utf-8" />
</head>

<body>
<p>Da&#32;brow&#35;a G�rn&#x3;icza<p>

</body>

</html>

I need to browse this page and copy the text shown

After that, I have pasted this text into an input text box of an asp.net mvc application in order to create a new record into the database. The meta charset of the layout page is "utf-8"

If I go to Visual Studio 2013 in debug, when the create action of the controller is executed, I can see the following string

This address has stored into a column of type nvarchar(255), and from sql management tool I see the same text as seen before:

If I copy and paste the address from database column to notepad++ I can see

After that I have to call a svc service in order to send the address data but I am receiving from the other side this exception

ERROR TRANSFORMING XML '' HEXADECIMAL VALUE 0X03 is an invalid character.

How can I avoid this exception being thrown ?


回答1:


0x03 is simply not an allowed character in XML :

[2] Char ::= #x9 | #xA | #xD | [#x20-#xD7FF] | [#xE000-#xFFFD] | [#x10000-#x10FFFF]

Therefore your textual object is not XML, and any conformant XML processor is obliged to report an error such as the one you received.

You must repair the data by treating it as text, not XML, manually or automatically before using it with any XML libraries.



来源:https://stackoverflow.com/questions/36306902/hexadecimal-value-0x03-is-an-invalid-character

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!