escaping

C++ inserting wchar_t backslash into string

孤街浪徒 提交于 2019-12-11 02:07:24
问题 I have a wide char literal: const wchar_t* charSet = L" !\"#$%&'()*+,-./0123456789:;<=>?\n" L"@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_\n" L"`abcdefghijklmnopqrstuvwxyz{|}~\n"; When I pass it into text processor '\'(backslash) isn't there.Now if I put instead \\ it I am getting compile time error: "missing closing quote" So how do I put backslash into such a char string? 回答1: As for your original code L" !\"#$%&'()*+,-./0123456789:;<=>?\n" you simply missed escaping the quote character " again.

How to send HTML elements through JSON using PHP?

本秂侑毒 提交于 2019-12-11 01:38:14
问题 The following function try{ $query = $this->pdo->prepare("SELECT * FROM bookings WHERE TourID = ? AND dTourDate = ? and Status NOT LIKE 'Cancelled'"); $query->execute(array($tourId,$date)); $result = $query->fetchAll(PDO::FETCH_ASSOC); if(count($result)<1) $this->error("'Booking' Not Found.",$this->errCode->sqlNotBooking); $this->success("Booking List Success.",(array) $result); } returns me this: TotalPrice":"0.00","GuestName":"Bryan Pedrochi<\/span>","ContactNumber":"042214"... The

Why doesn't my attempt to escape quotation marks in JSON work?

一世执手 提交于 2019-12-11 01:28:37
问题 I am parsing a JSON-string with the JQuery.parseJSON function, as I have done lot's of times in my code. On this particular case, though, I get: Uncaught SyntaxError: Unexpected token R . The only upper case R that exists, in my JSON-formatted String, comes right after an escaped quotation mark, ... \"R ... like this. It seems like too much of a coincidence to be caused by anything other than this, but as far as I can tell, I have completely followed the proper syntax as described on json.org

How to escape embedded JSON after unescape

三世轮回 提交于 2019-12-10 23:46:33
问题 When serializing with Json.NET, I need to escape embedded JSON after previously unescaping while deserializing. Which means I unescaped following JSON according to this post. Here is my JSON: { "Message":null, "Error":false, "VData":{ "RNumber":null, "BRNumber":"Session1" }, "onlineFields":{ "CCode":"Web", "MNumber":"15478655", "Product":"100", "JsonFile":" { \"evaluation\":{ \"number\":[ { \"@paraID\":\"1000\", \"@Value\":\"\", \"@label\":\"We are america\" }, { \"@paraID\":\"2000\", \"

Print special characters via php inside a html element's attribute

别来无恙 提交于 2019-12-10 23:33:06
问题 Assume $string = AX èdfdfdèsèdsè'/\" (actually, $string is assigned this value from the DB) So when I print the following, echo "<option value='". htmlspecialchars($string) ."'>".$string."</option>"; I get the output, <option \"'="" value="AX èdfdfdèsèdsè">AX èdfdfdèsèdsè'/\"</option> How can I properly escape this so that I don't create another useless attribute & instead get the same value as in $string ? Also, what is the reason Php does not escape $string as a whole? 回答1: You should use

Regex clarification on escape sequences with lex

此生再无相见时 提交于 2019-12-10 23:19:10
问题 I'm creating a lexer.l file that is working as intended except for one part. I have the rule: [\(\*.*\*\)] {} which I want to make it so when I encounter (* this is a test *) in a file, I simply do nothing with it. However when I run lex lexer.l I get warning on lines with rules \( , \* , and \) stating that they can never be met. So I guess my question is why would [\(\*.*\*\)] {} interfere with \( and the others? How can I catch (* this is a test *) ? 回答1: Languages with the comment syntax

How to escape strings in bash script

99封情书 提交于 2019-12-10 22:53:44
问题 I am running a bash script that calls mysql. The password ist not correctly transmitted, I guess I have to escape some special chars, like the hash or the dollar sign? #!/bin/bash USER=myuser PASS="#mypass$" # ... call mysql 回答1: Using "..." is already the correct thing to do, but the $ needs to be escaped ( \$ ) if it isn't followed by an "invalid" character. However you also need to make sure to always have the variable in quotation marks as well, as in: somecommand -p "$PASS" 回答2: Try to

Trouble opening utf-8 URI's with Ruby's 'open-uri'

南楼画角 提交于 2019-12-10 21:17:22
问题 I'm trying to get Danish location addresses from google maps web services API with ruby and open-uri. Trying to get Ærø, Denmark : http://maps.googleapis.com/maps/api/geocode/json?address=ærø&sensor=false&region=dk works in Chrome does not with open-uri: require 'rubygems' require "open-uri" require 'json' uri = "http://maps.googleapis.com/maps/api/geocode/json?address=ærø&sensor=false&region=dk" response = open(uri) array = JSON.parse(response) pp array Here it yields /usr/lib/ruby/1.8/uri

How do I unescape HTML, then transform it with XSLT?

醉酒当歌 提交于 2019-12-10 21:11:17
问题 I'm fairly new to XSLT, and I have a large XML document that I'm trying to transform into ICML (an XML variant used by Adobe InDesign). The relevant portion of the source document I'm working with looks something like this: <BiographicalNote> <p>This text includes escaped HTML entities.</p> </BiographicalNote> The XML itself is fine but the HTML it contains is escaped. And here is a rough example of what I need the end product to look like: <ParagraphStyleRange> <CharacterStyleRange> <Content

How to map Menu key (“Application key”) to Escape key in vim?

懵懂的女人 提交于 2019-12-10 20:43:01
问题 I think that using Menu key to quit vim's insert mode would be a great thing. It would be also nice to use Super key for that, but I'm not sure if it possible since Super key is a modifier. Anyway, I couldn't find anything related to this. Looking for your help and thanks in advance! 回答1: I don't think there's any way you can configure Vim to pay attention to the Menu key as such, but depending on your system there are various ways to turn the Menu key into an Escape key. If you're using X11