escaping

How to use escape character in replace function when replacing quotations in VB

Here is my code snippet: Public Function convert(ByVal robert As String) Try robert = Replace(robert, "U", "A") robert = Replace(robert, "\"", "A") I want to actually replace the "quotations" with the A but the program doesn't seem to recognize the fact that I'm using an escape character in VB. Does a...

HTML tags within JSON (in Python)

I understand its not a desirable circumstance, however if I NEEDED to have some kind of HTML within JSON tags, e.g.: { "node": { "list":"<ul><li class="lists">Hello World</li><ul>" } } is this possible to do in Python without requiring to to be escaped beforehand? It will be a string initially so I was thinking a...

When to CDATA vs. Escape & Vice Versa?

I'm creating XML documents with values fetched from a DB. Occasionally due to a legacy implementation, I'll pullback a value that contains a char that's invalid when not properly escaped (& for example). So the question becomes, should I CDATA or Escape? Are certain situations more appropriate for one vs. the other? Examples: <Email>f...

how to override [] brackets in ruby ?

I am writing an Ajax request form with Ruby on Rails using a collection_select tag that looks like this: <%= collection_select("Jobs", "clearance", @allClearances, "clearance", "clearance", {:prompt => "Select a Clearance"} )%> Ruby then builds an HTML select tag with id = "Jobs_clearance" and name = "Jobs[clearance]" I want to send t...

How do I unescape XML special characters in Perl?

I'm processing some XML files (specifically .vcproj files) in Perl and I want to unescape the special characters. The escaped characters I've encountered so far are: &quot; &#x0D; &#x0A; Obviously I can do this myself but it seems that there should be a standard (or CPAN) module to do this but a naive search brings up nothing relevan...

LibXML2 Sax Parsing and ampersand

I've encountered (what I think is) a strange behavior when using the sax parser, and I wanted to know if it's normal. I'm sending this XML through the SAX parser: The "& a m p ;" gets converted to " & # 3 8 ;" when the startElement callback is called. Is it supposed to do that? If so, I would like to understand why. I've pasted an...

Where can I find a list of escape characters required for my JSON ajax return type?

I have an ASP.NET MVC action that is returning a JSON object. The JSON: {status: "1", message:"", output:"<div class="c1"><div class="c2">User generated text, so can be anything</div></div>"} Currently my HTML is breaking it. There will be user generated text in the output field, so I have to make sure I escape ALL things that need t...

JDMK HtmlAdaptorServer not escaping values in output HTML

I'm using the Java JDMK HtmlAdaptorServer to provide a debugging interface to some MBeans. However, any bean methods that return data that includes characters that need to be escaped do not display correctly since the HtmlAdaptorServer is apparently not performing any escaping. I took a look the source via the OpenDMK, and it would app...

Escape text for HTML

How do i escape text for html use in C#? I want to do sample="<span>blah<span>" and have <span>blah<span> show up as plain text instead of blah only with the tags part of the html :(. Using C# not ASP ...

The string "Test '<3'" displays as "Test '<3>" in my Rails app

I'm having a strange problem where a user can enter the following text Test '<3' and it outputs as Test '<3> On the output I'm using white_list, and the value stored in the database is: 'testing ''<3''' What could be causing the output to think it's a tag of some sort and trying to close it (which is what it looks like ...

How to stop XSL unescaping URLs

I am using XSL to display an XML representation of an email message in browsers. Email attachments are stored in separate files to the main email XML file, and so I want the resulting web page for the email to contain a link to its attachments. However some of the attachments are email messages themselves, and may have been forwards or ...

UTF chars retrieved with AJAX are not shown in Safari

Hi, I have problem rendering content retrieved via Ajax into my HTML page under Safari (v.4). The page is stored in UTF-8, Ajax response is also UTF-8 encoded. The loaded content is parsed and then different types of lists are populated with the parsed data. One of them is simple < select > element where the text of the option is set u...

Unescape _xHHHH_ XML escape sequences using Python

I'm using Python 2.x [not negotiable] to read XML documents [created by others] that allow the content of many elements to contain characters that are not valid XML characters by escaping them using the _xHHHH_ convention e.g. ASCII BEL aka U+0007 is represented by the 7-character sequence u"_x0007_". Neither the functionality that allow...

escaping URL request? ASP.NET C#

I have a request to a page that looks like /doSomthing?a=that&ret=url however now i need to login so i must do something like /login?ret=/doSomthing?a=that&ret=url This doesnt work as well as one may hope so how do i correctly escape the return URL then unescape it? I am using ASP.NET with C# ...

How Do You Prevent A javax Transformer From Escaping Whitespace?

I'm using the javax.xml.transform.Transformer class to perform some XSLT translations, like so: TransformerFactory factory = TransformerFactory.newInstance(); StreamSource source = new StreamSource(TRANSFORMER_PATH); Transformer transformer = factory.newTransformer(source); StringWriter extractionWriter = new StringWriter(); String xml ...

How can regex ignore escaped-quotes when matching strings?

Hi, I'm trying to write a regex that will match everything BUT an apostrophe that has not been escaped. Consider the following: <?php $s = 'Hi everyone, we\'re ready now.'; ?> My goal is to write a regular expression that will essentially match the string portion of that. I'm thinking of something such as /.*'([^']).*/ in order t...

Escaping the '\' character in the replacement string in a sed expression

I am trying to take a line of text like 13) Check for orphaned Path entries and change it to (I want the bash color codes to colorize the output, not display on the screen) \033[32m*\033[0m Check for orphaned Path entries with bash color codes to colorize the asterisk to make it stand out more. I have a sed command that does m...

Converting &amp; to & in Objective-C

Hi All, I have a URL string in the following format. http://myserver.com/_layouts/feed.aspx?xsl=4&amp;amp;web=%2F&amp;amp;page=dda3fd10-c776-4d69-8c55-2f1c74b343e2&amp;amp;wp=476f174a-82df-4611-a3df-e13255d97533 I want to replace &amp; with & in the above URL. My result should be: http://myserver.com/_layouts/feed.aspx?xsl=4&a...

.Net XML Serialization and Escaped or Encoded characters

I'm using XML Serialization heavily in a web service (the contracts pass complex types as params). Recently I noticed that the .Net XML Serialization engine is escaping some of the well known 5 reserved characters that must be escaped when included within an element (<, >, &, ' and "). My first reaction was "good old .Net, always looking...

Asp.Net MVC - ValidationMessage() - how to prevent HTML escaping?

In my scenario I'd like to display a text with URL link within validation message attached to form element on MVC view. I'm using ValidationExtensions.ValidationMessage extension method, like this: <%=Html.ValidationMessage(Model.Name) %> The behavior I'm seeing is that validation message is HTML escaped, what effectively prevents me ...