escaped-characters

How to generate real UTF-8 XML with grails without the escape characters?

I have been wondering why when I set the encoding to UTF-8 and rendering the XML it replace the extended characters by escape characters (or character reference) like ’ instead of '? I'm using the Render method render(contentType:"text/xml", encoding:"UTF-8") {...} with a proper header render(contentType:"text/xml", encoding:...

slashes in url variables

Hi there I have set up my coldfusion application to have dynamic urls on the page, such as www.musicExplained/index.cfm/artist/:VariableName However my variable names will sometimes contain slashes, such as www.musicExplained/index.cfm/artist/GZA/Genius This is causing a problem, because my application presumes that the slash in t...

how to detect an escape sequence in a string

Given a string named line whose raw version has this value: \rRAWSTRING how can I detect if it has the escape character \r? What I've tried is: if repr(line).startswith('\r'): blah... but it doesn't catch it. I also tried find, such as: if repr(line).find('\r') != -1: blah doesn't work either. What am I missing? thx!...

Printing escape character

When I am given "d""\"/""b", I need to print out the statement character for character. (d, b, a slash, a backslash, and 5 quotes) in C++. The only errors that show now are the lines if(i.at(j)="\\") and else if(i.at(j)="\""). Also, how should the outside double apostrophes be excluded? #include <iostream> #include <cstdlib> using n...

string s= @"somet"hing" what is wrong about this ?

I expected that there is no something wrong but VS2010 gives error. string s= @"somet"hing"; ...

Un-escaping characters present in recordset that is bound to control in Access 2003

I have some data stored in SQL Server that contains apostrophes. Within the SQL Server table to apostrophe is escaped. For example the phrase "Roberts's thesis" is stored as "Robert''s Thesis". I use Access 2003 as a font end for the application and I use ADO to access the data stored in SQL Server using Stored Procedures. The issue I a...

mysql insert escape

I currently have this code $main_cat = "Antiques-collectables"; $mcat = "0187-1443"; $sub_cat = "toys"; mysql_query(" INSERT INTO categories (id, main_cat, sub_cat, mcat) VALUES ('', '$main_cat', '$sub_cat', '$mcat') "); For some reasons the $mcat value is not stored properly . When I check it in the database it appears as "1" ...

What SqlCommand.Parameters.AddWithValue really does?

Hi, What changes SqlCommand.Parameters.AddWithValue() does with the query? I expect that: It replaces every ' character by '', If a parameter value is a string or something which must be converted to a string, it surrounds the value by ', so for example select * from A where B = @hello will give select * from A where B = 'hello world...

XSLT: Using copy-of to output xml

Hi, I am using the copy-of element in xsl to print some xml to client, but the xslt outputs the unescapes the escaped xml characters to the output e.g. if the xml being transformed is <one attr="http://one.com/page?param1=value1&amp;amp;param2=value2">    <child>text</child> </one> and if i use the copy-of to output this node <xsl:c...

Render escaped XML on browser

Hi, For the below xml i want to render the unescaped text parts on browser from xslt e.g.: <one> &lt;text&gt; </one> I want the markup rendered on browser to be: &lt;text&gt; But when I use the apply templates which looks like below <xsl:template match="text()" mode="literalHTML"> <xsl:copy-of select="."> </xsl:copy-of> </...

Tomcat(6) escapes text from beans before including it to resultig html

When I get from MyBean some text, for example, <p>Hello world</p> and include it into jsp via jsp:getProperty in resulting html page it will be &lt;p&gt;Hello world&lt;/p&gt; I could guess that tomcat's team did this due to security reasons but it's not behaviour that I want to get. Q:how to get needed behaviour? UPD: @Jörn Horstman...

Is there a better way to double escape (or escape twice) user input in BASH than calling printf twice?

This script will read an old and a new value from the user and then use sed to find and replace them in a file. For example if I entered T*T*z and B*B*z it would look for T\*T\*z in the file and replace with B\*B\*z. It works but I've been trying to make this more concise. I don't have any need for the intermediate variables $ESC_OL...

escape characters <%= h("") %> and how to deal with double quote ruby on rail

Hi, This might be a simple question to answer, but I couldn't find the answer. In ruby on rails, I thought the helper function would help escape special characters. Example: " She's the one that took me "to" " Code wise: <%= h("She's the one that took me "to" ") %> However, the double quote won't allow me to display the code on the...

Mobile Phone Browse Escape Ampersand (&) for URL Developed in ASP.NET MVC?

This is a strange one that I cannot see to figure out. I have a basic mobile site that is coded in ASP.NET MVC (really shouldn't matter in this case but just to put it out there) When I browse to the specific page, I receive the following error. This page contains the following errors: error on line 56 at column 43: EntityRef: expect...

How to get a Char from an ASCII Character Code in c#

Im trying to parse a file in c# that has field (string) arrays separated by ascii character codes 0, 1 and 2 (in Visual Basic 6 you can generate these by using Chr(0) or Chr(1) etc.) I know that for character code 0 in c# you can do the following: char separator = '\0'; But this doesnt work for character codes 1 and 2? ...

Convert unicode to ISO 8859-2 in .net

Hello, Im messing a lot with encoding stuff. I see UTF-8, Unicode, Latin, ISO, RTC, etc... But i dont understand the relation between them. How could i convert from Unicode to ISO 8859-2? Thanks in advance. Regards. ...

Javascript: Window.Open with a # sign in URL?

I have a local web app that lets users attach and view files. Viewing files is simply window.open(fileName), however whenever the filename has a # sign in it the file will fail to open with a dns error. I've tried escaping the # symbol with %23, and \# but it still fails to open... is there something special I need to do to escape the # ...

printing "<html>" using html

How to print "html" tag ( including '<' and '>' also) tag using html without using text areas and javascipt also ...

Invalid character string partly recognized? c++

BLUF: In this function, \' prompt the error message but not \?, Why? char key[] = "\a\b\f\n\r\t\v\\\'\"#%&*;:<>\?/{|}~"; if (strpbrk(*local_str, key) != NULL ) { vico_param_out->out_valid = false; AfxMessageBox("L'identifiant de numérisation est invalide. Vous avez saisi des caractères qui ne peuv...

Convert characters in a c string to their escape sequences

Hi, I need a function like string ToLiteral(string input) from this post. Such that char *literal = to_literal("asdf\r\n"); Would yield literal ==> "asdf\\r\\n". I've googled around, but not been able to find anything (guess that I've must be using the wrong terms). However, I assume that a library with this functionality must be out...