4

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

the text to be copied

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 is the address in debug mode

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

this is the address from the database

If I copy and paste the address from database column to notepad++ I can see enter image description here

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 ?

kjhughes
  • 106,133
  • 27
  • 181
  • 240
Lluthus
  • 335
  • 2
  • 5
  • 15

1 Answers1

4

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.

kjhughes
  • 106,133
  • 27
  • 181
  • 240