invalid-characters

How to stop XMLReader throwing Invalid XML Character Exception

谁都会走 提交于 2019-12-09 17:58:29
问题 So I have some XML: <key>my tag</key><value>my tag value &#xB;and my invalid Character</Value> and an XMLReader: using (XmlReader reader = XmlReader.Create(new StringReader(xml))) { while (reader.Read()) { //do my thing } } I have implemented the CleanInvalidCharacters method from here but as the "&#xB" is not yet encoded it doesn't get removed. The error is being thrown at the reader.Read(); line with exception: hexadecimal value 0x0B, is an invalid character. 回答1: The problem is that you

SCRIPT1014: Invalid character - Quote symbol

a 夏天 提交于 2019-12-07 10:31:23
问题 I have this problem: array[i].idAuthor is a String variable. I want to pass this String to a function which is called inside an append-String. The code works fine in Chrome and Firefox except for Internet Explorer. IE gives me this error: SCRIPT1014: Invalid character I think the issue are the `-Quotes . I hope the following example helps to express my problem. <script> (...) $("#id").append("<div onClick='myFunc(`" + array[i].idAuthor + "`);'>" + i + "</div>"); (...) <script> Is there

SCRIPT1014: Invalid character - Quote symbol

跟風遠走 提交于 2019-12-05 19:38:32
I have this problem: array[i].idAuthor is a String variable. I want to pass this String to a function which is called inside an append-String. The code works fine in Chrome and Firefox except for Internet Explorer. IE gives me this error: SCRIPT1014: Invalid character I think the issue are the `-Quotes . I hope the following example helps to express my problem. <script> (...) $("#id").append("<div onClick='myFunc(`" + array[i].idAuthor + "`);'>" + i + "</div>"); (...) <script> Is there another way to handle my situation or to replace the `-Quotes with another character that is compatible with

Check for valid utf8 string in Python

…衆ロ難τιáo~ 提交于 2019-12-05 18:39:38
问题 I'm reading filenames from file system and I want to send them as JSON encoded array. The problem is that files on file system can be stored in invalid encoding, and I need to handle this situation to omit invalid filenames before passing it to json.dump , otherwise it will fail. Is there a way to check that my string (filename) contains valid utf-8 chars? 回答1: How about trying the following? valid_utf8 = True try: filename.decode('utf-8') except UnicodeDecodeError: valid_utf8 = False ...

What are valid characters for Windows environment variable names and values?

谁说胖子不能爱 提交于 2019-12-05 11:12:37
问题 After some reseach, I found out that length limits for names are 255 and for values 32767 characters. But which characters are allowed for names ? And which characters are allowed for values ? 回答1: About variable values: you can use most characters as variable values, including white space. If you use the special characters <, >, |, &, or ^, you must precede them with the escape character (^) or quotation marks. If you use quotation marks, they are included as part of the value because

xsl trying to ouput '<' as opposed to '<'

家住魔仙堡 提交于 2019-12-04 23:34:09
问题 Update: The issue still persists although it is not quite the same as before. Below is an example of what is being input, what is being output and what I want to have output An example of the input: &lt;p&gt;&lt;span style=&quot;font-size: medium&quot;&gt;Product description text&lt;/span&gt;&lt;/p&gt; Current output: <p><span style="font-size: medium">Product description text</span></p> Intended output: <p><span style="font-size: medium">Product description text</span></p> . Using CDATA has

ASP.NET Invalid character in a Base-64 string

半腔热情 提交于 2019-12-03 16:23:22
I recently implemented ELMAH on my site and I have noticed that we frequently get the "Invalid character in a Base-64 string" error. I have never triggered it myself and none of our users have complained about it so I don't know what is going on. From the little I was able to find about it it seems like the viewstate might be getting too big or becoming corrupted or something. Does anybody know what causes this and how to prevent it? Here are what I believe are the pertinent lines in the YSOD. [FormatException: Invalid character in a Base-64 string.] [ViewStateException: Invalid viewstate.

xsl trying to ouput '<' as opposed to '<'

你离开我真会死。 提交于 2019-12-03 15:05:57
Update: The issue still persists although it is not quite the same as before. Below is an example of what is being input, what is being output and what I want to have output An example of the input: &lt;p&gt;&lt;span style=&quot;font-size: medium&quot;&gt;Product description text&lt;/span&gt;&lt;/p&gt; Current output: <p><span style="font-size: medium">Product description text</span></p> Intended output: <p><span style="font-size: medium">Product description text</span></p> . Using CDATA has helped as it allows me to input '<' but as seen in the output above, even when using disable-output

Cannot get xslt to output an (&) even after escaping the character

会有一股神秘感。 提交于 2019-11-30 07:52:11
问题 I am trying to create a query string of variable assignments separated by the & symbol (ex: "var1=x&var2=y&..." ). I plan to pass this string into an embedded flash file. I am having trouble getting an & symbol to show up in XSLT. If I just type & with no tags around it, there is a problem rendering the XSLT document. If I type & with no tags around it, then the output of the document is & with no change. If I type <xsl:value-of select="&" /> or <xsl:value-of select="&" /> I also get an error

Parsing invalid ampersands with Android's XmlPullParsers

谁说我不能喝 提交于 2019-11-29 10:31:07
I am writing a little screen-scraping app that consumes some XHTML - it goes without saying that the XHTML is invalid: ampersands aren't escaped as & . I am using Android's XmlPullParser and it spews out the following error upon the incorrectly encoded value: org.xmlpull.v1.XmlPullParserException: unterminated entity ref (position:START_TAG <a href='/Fahrinfo/bin/query.bin/dox?ld=0.1&n=3&i=9c.0323581.1266265347&rt=0&vcra'> @55:134 in java.io.InputStreamReader@43b1ef70) How do I get around this? I have thought about the following solutions: Wrapping the InputStream in another one that replaces