double-quotes

simple error due to use of double quotes in a jsp file

自闭症网瘾萝莉.ら 提交于 2019-11-27 12:23:15
问题 I have the following line of code in a JSP File in my web app that is giving an error: <jsp:setProperty name="db" property="userName" value="<%=request.getParameter("userName")%>"/> The error message that I get is: org.apache.jasper.JasperException: /loginbean.jsp(6,59) Attribute value request.getParameter("userName") is quoted with " which must be escaped when used within the value What I read on some sites is that characters like ' (single quote) or " (double quote) need to be prefixed with

json parse error with double quotes

跟風遠走 提交于 2019-11-27 08:11:39
A double quote even if escaped is throwing parse error. look at the code below //parse the json in javascript var testJson = '{"result": ["lunch", "\"Show\""] }'; var tags = JSON.parse(testJson); alert (tags.result[1]); This is throwing parse error because of the double quotes (which are already escaped). Even eval() won't work here. But if i escape it with double slashes like this: var result = '{"result": ["lunch", "\\"Show\\""] }'; var tags = JSON.parse(result); alert (tags.result[1]); then it works fine. Why do we need to use double slash here in javascript? The problem is that PHP json

Convert all types of smart quotes with PHP

别来无恙 提交于 2019-11-27 07:17:39
I am trying to convert all types of smart quotes to regular quotes when working with text. However, the following function I've compiled still seems to be lacking support and proper design. Does anyone know how to properly get all quote characters converted? function convert_smart_quotes($string) { $quotes = array( "\xC2\xAB" => '"', // « (U+00AB) in UTF-8 "\xC2\xBB" => '"', // » (U+00BB) in UTF-8 "\xE2\x80\x98" => "'", // ‘ (U+2018) in UTF-8 "\xE2\x80\x99" => "'", // ’ (U+2019) in UTF-8 "\xE2\x80\x9A" => "'", // ‚ (U+201A) in UTF-8 "\xE2\x80\x9B" => "'", // ‛ (U+201B) in UTF-8 "\xE2\x80\x9C"

Remove double quote in json_encode()

一个人想着一个人 提交于 2019-11-27 05:20:52
I want remove double quote in my json_encode, that is my code: <?php require_once 'config.inc.php'; //## Clase Base de Datos require_once 'Database.class.php'; //## Obtengo los parametros pasados por el metodo GET $params = $_REQUEST; $db = new Database(DB_SERVER, DB_USER, DB_PASS, DB_DATABASE); $db->connect(); $result = mysql_query("SELECT * from ranking WHERE posicion BETWEEN ".$params['pos_ini']." AND ".$params['pos_fi']) or die('Could not query'); if(mysql_num_rows($result)){ $array_json=array(); $filas = mysql_num_rows($result); $columnas = mysql_num_fields($result); for($i=0;$i<$filas;$i

PHP JSON String, escape Double Quotes for JS output

徘徊边缘 提交于 2019-11-27 04:35:23
I'm creating a JSON string from a PHP array. I've encoded it using json_encode() . $data = array( 'title' => 'Example string\'s with "special" characters' ); $data = json_encode( $data ); $data is localized using wp_localize_script() and is accessible via a global data variable. In the JS file I can access the information by the following: var data = data.replace( /"/g, '"' ), jsonData = jQuery.parseJSON( data ); console.log( jsonData ); This results in an output of: { "title":"Example string's with "special" characters" } Entering that result into http://jsonlint.com/ returns an error.

How to read \" double-quote escaped values with read.table in R

送分小仙女□ 提交于 2019-11-27 04:35:13
问题 I am having trouble to read a file containing lines like the one below in R. "_:b5507F4C7x59005","Fabiana D\"atri" Any idea? How can I make read.table understand that \" is the escape of quote? Cheers, Alexandre 回答1: It seems to me that read.table/read.csv cannot handle escaped quotes. ...But I think I have an (ugly) work-around inspired by @nullglob; First read the file WITHOUT a quote character. (This won't handle embedded , as @Ben Bolker noted) Then go though the string columns and remove

Send a text string containing double quotes to function

血红的双手。 提交于 2019-11-27 03:36:27
问题 I'm having a problem with using double quotes while formatting text strings being sent to functions in R. Consider an example function code: foo <- function( numarg = 5, textarg = "** Default text **" ){ print (textarg) val <- numarg^2 + numarg return(val) } when running with the following input: foo( 4, "Learning R is fun!" ) The output is: [1] "Learning R is fun!" [1] 20 But when I try (in various ways, as suggested here) to write "R" instead of R, I get the following outputs: > foo( 4,

How to escape double quotes in as a parameter to an NUnit TestCase?

对着背影说爱祢 提交于 2019-11-27 03:02:19
问题 I tried writing the following TestCase for an NUnit test written in VB.net: <TestCase("FirstNode", "<node id=\"FirstNode\">")> Public Sub GetNode_GivenSomeNodeId_ReturnCorrectNode(ByVal nodeId as String, ByVal expectedXml as String) (Call the method under test and request the xmlNode with the provided id...) Assert.AreEqual(expectedXml, returnedXml) End Sub The xml-node passed as the second parameter to the testcase is not valid however, as this clearly is not the correct way to escape double

Omitting the double quote to do query on PostgreSQL

余生颓废 提交于 2019-11-27 01:55:59
Simple question, is there any way to omit the double quote in PostgreSQL? Here is an example, giving select * from A; , I will retrieve ERROR: relation "a" does not exist , and I would have to give select * from "A"; to get the real result. Is there any way not to do the second and instead do the first on PostgreSQL? Your problem with this query started when you created your table. When you create your table, don't use quotes. Use this: CREATE TABLE a ( ... ); Not this: CREATE TABLE "A" ( ... ); The latter will make it so that you always have to quote it later. The former makes it a normal

How does the leading dollar sign affect single quotes in Bash?

北战南征 提交于 2019-11-27 00:08:21
问题 I need to pass a string to a program as its argument from the Bash CLI, e.g program "don't do this" The string may include any character like '$' , '\' , etc. and I don't want Bash to do any modification. So I think about using single quotes. However the following does not work: program 'don\'t do this' //escape doesn't work in single quote While the following two works: program $'dont\'t do this' //seems fine, but any other side effects? program 'dont'\''do this' //breaking into 3 parts The