How to handle single, double quotes

Hi,
I have a dataset which contains single- and doubble quotes.
But when using the DS in javascript, I have problems in handing strings containing  single- and doubble quotes.
            <td onclick="myFunction('{TITLE}');">{TITLE}</td>
{TITLE} is equal to:  I'm working with spry.
Spry replaces it in the code as: <td onclick="myFunction('I'm working with spry');">I'm working with spry</td>
Which leads to a quote error in the functionCall onclick().
I've tried to solve the problem by escaping these special characters in PHP;
- addslashes() > solves the javascript error, but give a readable text: I\'m working with spry
- htmlspecialchars() > no change in existing problem.
Any clues how to solve this.
Thanks,
Pieter

Hi Pieter,
When writing text in an HTML document I always use entity references (like &lsquo; for a single quote)  for special characters to not only overcome the sort of problem that you are faced with, but this is also good practice for normal rendering of text in most languages including HTML, XML and JS.
You could also use character reference (like &#8217; for a single quote) with the same result, but DW has inbuilt functions to help with entity reference.
Having said this, and assuming that you cannot or it is impracticable to change the data within the database, why not have two fields in your dataset, one called JS_TITLE and the other just TITLE and use each one accordingly.
This still does not satisfy the fact that the single quote for rendering purposes is not represented by a reference, but that is another matter.
Gramps

Similar Messages

  • How to escape the double quote in URL

    Hi,
    I know that using backslash we can escape the ',' while sending the data between pages using URL.
    Can any body please help me how to escape the double quotes.
    Thanks a lot.

    Thanks again for the reply and now I am able to encrypt and decrypt my document number... one more question please : will it be possible to chnage the whole URL to some basic message type URL for eg:
    let's say our URL is "http://testdoc/post?mssg" and I want to change this to as "OPEN DOCUMENT" and when user clicks on ""OPEN DOCUMENT" it will still direct to the original destination that is our original URL.
    I have been told that we don;t want to maintain custom table until and unless it's our last choice.
    Thanks,
    Rajat

  • How to print/post double-quotes on reportserver

    Hi, I am using rwservlet and cannot send double quotes. I can escape single quotes with another single quote, but double doublequotes do not work. I have tried url-encoding and html encoding, and even their combination, but report server just refuses to generate the PDF with a string with a double quote.
    this is my URL:
    http://rs-server:7778/reports/rwservlet?cmdkey&report=somereport.jsp&desformat=pdf&TESTSTRING=aaaaaaaa&destype=cache&ACTUSER=19
    now I would need in TESTSTRING to have double quotes
    PS: tried BI Oracle Business Intelligence 10g (10.1.2) and forms and reports 10g

    PostScript printer - send it to the printer port e.g. LPT1: with a simple copy.
    Non-PostScript printer - you'll need to buy a PostScript RIP, or perhaps use Acrobat Distiller to convert the PostScript to PDF, then print the PDF with Acrobat's API - see the Acrobat SDK. (This is not possible with the free Reader).

  • How to handle newline within quotes in csv

    Hello experts,
    I have an issue with reading a csv file which contains newline as a part of one of the fields (within double quotes).
    I'm using the file content conversion in sender file adapter with the following
    NameA.fieldNames = field1, field2, field3, field4
    NameA.fieldSeparator = ,
    NameA.processFieldNames = fromConfiguration
    NameA.enclosureSign = "
    NameA.enclosureSignEscape = ""
    NameA.endSeparator = 'nl'
    This doesn't work. The sender channel treats the newline within double quotes as a new record and is not reading the file correctly.
    I though the NameA.enclosureSign and NameA.enclosureSignEscape parameters would do the trick and ignore text that's between the double quotes?
    An I missing some Content conversion cofiguration here? Some parameter that I need to set?
    Please help resolve this.
    Thanks
    Karthik

    Hi,
    I have a scenario similar to this.
    ClaimsRecords.fieldNames  :  CompanyName,Invoice,InvoiceDate....,Location Name,...
    ClaimsRecords.fieldSeparator  :  ,
    ClaimsRecords.enclosureSign  :  "
    ClaimsRecords.endSeparator  :  'nl'
    The sample file will look like this:
    XYZ,123,21122011,......,"Delhi
    India",312,...
    ABC,234,22122011,......,"Bangalore
    India",432,....
    The new line character comes inside the value of the LocationName field. But the above entries made in FCC will handle this kind of file correctly.
    Recheck the FCC entries and even check if the file is coming in correct format.
    Regards,
    Aravind

  • How to replace one double quotes with two double quotes in XSLT

    How can I replace one double quote to a two double quote in a string in XSLT
    I am passing the parameter string to XSLT template contains the value as
    <xsl:variable name="Description">Hi! "How are you</xsl:variable>
    <xsl:variable name="VQuotes">""</xsl:variable>
    I nead the output as
    Hi! ""How are you.
    Tried with Translate function, but it did not work out
    <xsl:element name="DESCRIPTION_SHORT">
              <xsl:value-of select="translate($Description,'&quot;', VQuotes)" />
            </xsl:element>But it is giving the same result as Hi! "How are you
    When I tried with
    <xsl:element name="DESCRIPTION_SHORT">
              <xsl:value-of select="translate($Description,'&quot;', 'BB')" />
            </xsl:element>
    It gave the result as
    Hi! BHow are you.
    It is replacing only one character with one. how to make it for two characters.
    Am I doing anything wrong in syntax?
    Please help.
    Regards, Vignesh S

    Hi Vignesh,
    Try this.
    Its a two step process:
    Step1: Add the following template would be "called" to do the replacement as your want:
    <xsl:template name="string-replace-all">
    <xsl:param name="text" />
    <xsl:param name="replace" />
    <xsl:param name="by" />
    <xsl:choose>
    <xsl:when test="contains($text, $replace)">
    <xsl:value-of select="substring-before($text,$replace)" />
    <xsl:value-of select="$by" />
    <xsl:call-template name="string-replace-all">
    <xsl:with-param name="text"
    select="substring-after($text,$replace)" />
    <xsl:with-param name="replace" select="$replace" />
    <xsl:with-param name="by" select="$by" />
    </xsl:call-template>
    </xsl:when>
    <xsl:otherwise>
    <xsl:value-of select="$text" />
    </xsl:otherwise>
    </xsl:choose>
    </xsl:template>
    Step2: Call the above templeate in the place where you want to call, like this:
    <!--Define the variables-->
    <xsl:variable name="Description">Hi! "How are you</xsl:variable>
    <xsl:variable name="sQuotes">"</xsl:variable>
    <xsl:variable name="VQuotes">""</xsl:variable>
    <!--Following call the template which you have defined in step1-->
    <xsl:element name="DESCRIPTION_SHORT">
    <xsl:variable name="myVar">
    <xsl:call-template name="string-replace-all">
    <xsl:with-param name="text" select="$Description" />
    <xsl:with-param name="replace" select="$sQuotes" />
    <xsl:with-param name="by" select="$VQuotes" />
    </xsl:call-template>
    </xsl:variable>
    <xsl:value-of select="$myVar" />
    </xsl:element>
    I have tested this and works. And outputs as the following with two-double quote as you want.
    <DESCRIPTION_SHORT>Hi!
    ""How are you</DESCRIPTION_SHORT>
    If this answers your question please mark it accordingly. If this post is helpful, please vote as helpful by clicking the upward arrow mark next to my reply.

  • How to handle single quote between two single quotes in ABAP?

    Dear SAP Gurus
    I have a question regarding handling a string data.
    Say I have a string  ABCD'\&%$!!ABC'AAA123.   Please notice that there are single quotes in my string.
    I am writing a parser code in ABAP and getting into problem with if statement to check if the character read is a single quote.
    When I type the following with a singleQuote between 2 singleQuoes as below, it gives error.
    If CHAR = '''.
    ENDIF.
    How do I handle that? I searched for escape sequence and couldn't get any useful info.
    Any feedback will be highly appreciated.
    Thanks
    Ram

    Or just use string literals
    if char = `'`.   "note that ` is the "backquotation" mark not a regular quotation mark '
    Regards
    Marcin

  • How to handle the double byte fonts in SAP ?

    Hi all,
    Can anyone provide me some links/documentations on using double byte fonts in generating PDF outputs using Adobe Document Services (ADS).
    Thanks in advance.
    Regards,
    Ravikiran.C

    Hi Ravikiran
    there are no SAP documents specifically on this topic. To use double-byte characters with Interactive Forms, you need to install the corresponding fonts. No additional steps are required.
    Laxmi's link refers to an IBM website. The IBM cooperation with Adobe is different from SAP's development partnership, but I guess the points on double byte characters probably apply here, too.
    Kind regards
    Markus Meisl
    SAP NetWeaver Product Management

  • Straight Double Quotes

    i have some different problem with the handling the double quote
    need to insert some text with inch symbol (Straight Double Quotes)
    the text is having a single double quote when placed in the text frame it becomes right double quote by default.
    e.g. 12 * 13"
    i find it hard to bend it to straight double quote.
    i found there is a SpecialCharacters.DOUBLE_STRAIGHT_QUOTE but i don't know how to use it inserting in the textframe hence it is number value.

    hi kasyan
    thanks.
    but you know i 'm doing like this
    create a temp text frame ,
    insert this straight double quotes in the textframe
    write string .replace to the existing string which has curly quotes with the temp textframe.contents
    but you know after replacing it too becomes curly
    the sample code.
    var dummyTF = actDoc.textFrames.add();
    dummyTF.insertionPoints[-1].contents = SpecialCharacters.DOUBLE_STRAIGHT_QUOTE;
    this.textContents = this.textContents.replace("x", dummyTF.contents );
                                                                //this.textContents = this.textContents.replace(/(“|”)/g, "-" );
    dummyTF.remove();
                                                                //SpecialCharacters.DOUBLE_STRAIGHT_QUOTE
                                                                refDebugInfo += "\n Current Content : " + this.textContents;
    txtFrm.contents = this.textContents ;

  • Problems parsing double quote

    I have been trying to figure out my problem for several hours, but still didn't get it. Hope to get an idea from you guys. My code is as follows:
    var astr;
    var outCr ="|";
    var outLf = "\u0000";
    var cr = "\n";
    var lf ="\r";
    var ddQuote=""";
    var dtQuote='\"';
    astr = "<%=firstDesc%>";
    astr.replace(outCr,cr);
    astr.replace(outLf,lf);
    astr.replace(ddQuote, dtQuote);
    while (astr.indexOf(outCr) > 0) {
    z = astr.indexOf(outCr);
    astr = astr.substring(0, z) + cr + astr.substring(z+1,astr.length );
    while (astr.indexOf(outLf) > 0) {
    z = astr.indexOf(outLf);
    astr = astr.substring(0, z) + lf + astr.substring(z+1,astr.length );
    while (astr.indexOf(ddQuote) > 0) {
    z = astr.indexOf(ddQuote);
    astr = astr.substring(0, z) dtQuote astr.substring(z+1,astr.length );
    document.form1.description.value=astr;
    The value of firstDesc is a very big string from the database that contains carriage return, linefeed, single quote and double quote. It needs to be displayed in a HTML text area. Now everything works fine except the double quote. A firstDesc value containing double quote will not appear in the text area, and it even stop my jsp page and disable other buttons. But if I get rid of the code handling the double quote, everything works fine. What's the problem?

    maybe you should ask this question in a JavaScript forum.

  • Solr search returns 0 results if search phrase is in double quotes

    sI have one search result that looks like this:
    Outlook Out of Office Assistant
    Jul, 28, 2014 - To activate the Out of Office Assistant: On the Tools menu click Out of Office Assistant. In the Out of Office Assistant dialog box select the Send Out of Office auto-replies radio button. If you want to specify a set time and date range select the Only send during this time range check box. Then set the Start time and then set the...
    When I do this search, I get 10 results back including the one above.
    <cfsearch
    name="qTechTips"
    collection="#collection#"
    criteria='secondary_id_i:24 out of office'
    orderby="sort_date_s desc"
    />
    But when I do a phrase search for "Out of Office":
    <cfsearch
    name="qTechTips"
    collection="#collection#"
    criteria='secondary_id_i:24 "out of office"'
    orderby="sort_date_s desc"
    />
    or
    <cfsearch
    name="qTechTips"
    collection="#collection#"
    criteria='secondary_id_i:24 "Out of Office"'
    orderby="sort_date_s desc"
    />
    I get 0 results. What am I doing wrong? I would like to do a phrase match to what is in the body, not the "title".
    I am on ColdFusion 11, update 3

    Escaping the quotes didn't help .I already read the solr search examples by Adobe but that didn't help me much. I don't know if this is documented in the CF documentation anywhere (I couldn't find it). What I worked for me after looking at the Apache Solr documentation was that you need to add "+" in between the words in the phrase:
    <cfsearch
    name="qTechTips"
    collection="#collection#"
    criteria='secondary_id_i:24 "Out+of+Office"'
    orderby="sort_date_s desc"
    />
    Expecting my users to enter "+" is a bit much but I know they can handle putting double quotes about phrases they want an exact match for. After some googling, this is my solution for automatically adding the "+" between the exact phrase for cfsearch processing (if you have a better solution, please let me know) :
      <!--- ////START: solr search --->
      <cfset solr_criteria = "">
      <!--- //START:Process the user's input if they use exact phrase search (in double quotes). I change their keyword input so it is cfsearch friendly. If a user enters 'how to set "Out of Office" and "Web Access"', we clean it up so it is 'how to set  "Out+of+Office" and "Web+Access"' for the cfsearch--->
      <!--- I don't know if there is a better way to do this, but this is what I came up with. --->
      <cfset txt_keyword_solr = #txt_keyword#>
      <cfif find('"',txt_keyword_solr)>
        <cfset stringphrase = reMatch('"([^"]*)"',txt_keyword_solr)>
        <!--- <cfdump var="#stringphrase#" label="Example REMatch"> --->
        <cfloop array="#stringphrase#" index="i">
          <cfset txt_keyword_solr = #ReplaceNoCase(txt_keyword_solr,i,rereplace(i, " ","+","all"),"all")#>     
        </cfloop>
      </cfif>
      <cfif LEN(TRIM(txt_keyword_solr)) GT 0>
        <cfset solr_criteria = solr_criteria & ' ( #Trim(preservesinglequotes(txt_keyword_solr))# ) '>
      </cfif>
      <!--- //END:Process the user's input if they use exact phrase search (in double quotes). --->
      <cfsearch
    name="qTechTips"
    collection="#collection#"
    criteria="#solr_criteria#"
    orderby="sort_date_s desc"
    />
      <p><cfoutput>#solr_criteria#</cfoutput></p>
      <!--- ////END: solr search --->

  • Escape double quotes

    hey, how to escape the double quote in xml document?
    eg. for description="SHAFT X 10" "
    <xml_header id="0" action="Export" from_loc="KJA" to_loc="" doc_model="SpInventory" doc_key="" doc_ref_no="" done_by="j">
    <xml_header.items>
    <sp_inventory id="1028" description="SHAFT X 10" " category="BELL" />
    </xml_header.items>
    </xml_header>
    i write the XML file in this way:
    String exportFile = dir + rename(fileName);
                File file = new File(exportFile);
                PrintWriter fout = new PrintWriter(new FileWriter(file));
                ObjectXMLWriter writer = new ObjectXMLWriter(fout);
                writer.write(ob);
                fout.close();Pls help. Thanks.

    Sorry, wrong forum

  • Handling smart/curly quotes in Java

    Hi - I want to know how to handle smart / curly quotes in Java. I need to replace them with actual quotes. I was trying somethin like below.
    xmlString = xmlString .replaceAll( "‘", "&apos;" );
    but this is not working. Just tried to print indexOf( ""‘") and it only returns -1. I was trying to use the html equiv value inside i.e &#8216(folowed by semicolon. the preview replaces it with actual value)
    Pls guide me on this. Its urgent!!
    -Thanks,
    Magesh
    Edited by: magesh_rathnam on Jan 31, 2010 7:09 PM
    Edited by: magesh_rathnam on Jan 31, 2010 7:10 PM

    I guess not then...
    Anyhow try this:
    public static String replaceSmartQuotes(String smartQuotedString) {
      return smartQuotedString.replaceAll("[“”]", "\"").replaceAll("[‘’]", "'");
    }{code}
    Mel                                                                                                                                                                                                                                                                                                                                                                                                                       

  • How to replace double quotes with a single quote in a string ?

    Hi All:
    Can some one tell me how to replace double Quote (") in a string with a single quote (') ? I tried to use REPLACE function, but I couldn;t get it worked.
    My example is SELECT REPLACE('STN. "A"', '"', ''') FROM Dual --This one throws an error
    Thanks,
    Dima.

    Whether it is maybe not the more comfortable way, I like the quoting capabitlity from 10g :
    SQL> SELECT REPLACE('STN. "A"', '"', q'(')') FROM Dual;
    REPLACE(
    STN. 'A'{code}
    Nicoals.                                                                                                                                                                                                                                                                                                                                                                                                                                       

  • How to replace single quote with double quote

    hai all,
    i have a problem,
    i am trying insert a string containing single quote into ms-access database.
    it is giving error.
    how can i avoid this .if i replace a single quote in the text with double quote it will defenitely
    insert into database.
    in java.lang.String
    replace () will not work to replace quote with double quote.
    any otherway to solve this problem.
    please mail me to [email protected]
    thank you
    sambareddy
    inida

    java.lang.String.replace () will not work to replace quote with double quote.Really?
    String x = ...
    x.replace( "'", "\"" );

  • How to handle ' " '(double quotes) in .csv file during migration

    I am facing problem in migrating data from sql server 2000 into oracle via .csv file using sql loader.
    1>How should i migrate the string which contains ' " ' (double quotes) characters,
    as i am enclosing the string in ' " ' in .ctl file (enclosed by ' " ').
    is there any syntax in the control file which can migrate the ' " '(double quotes) as it is as the data in the files is 50000 records .?
    Thank you..

    Yes this is correct.
    but problem will occur when e.g check the foll. string.
    (1001,And I quote "This, will work")
    Here it is a comm(,) in b/w "This and will".
    due to this sqlldr interpret it as end of field. and throws an error.
    I had gone through expert one on one oracle, what it maintioned as,
    put an extra double quotes( " ) like " " to enclosed the double quoted string.
    This works fine. For small data it can be done manually.
    But for large data what condition can be put in the ctl file to achieve this?
    or is there any other way to achieve this?
    Thank you.

Maybe you are looking for

  • Stop motion with flash

    Hi everyone. i want to create an animation with stop motion. Create a sequence with 160 photos  numbered continuous. It's with flash cs3. thanks a lot!

  • SPRUNCONVERSION and SPRUNCONSO

    I experiment some troubles with the SPRUNCONVERSION and SPRUNCONSO stroreproc. SPRUNCONVERSION My time dimension is based on this structure : YYYY (level : year) |__SS (semester and level coded as quarter) |____QQ (quarter and level coded as month) W

  • Is OAE H-A? Can it sustain a database crash?

    A recent database crash caused HTMLDB 1.6 to crash, showing "Service unavailable" even after the database was back up. Is it designed to sustain a brief database outage? Can it be configured to recover, failback, failover, without a restart of the ap

  • Enhancement: Ability to turn off the "Show More"

    I like the idea of the "Show More" when there are lots of tables/views/packages/etc., but the way it defaults to showing the first stuff alphabetically means that all the tables I want are almost always under the "Show More" link. Is there any way to

  • Analogue of the adf.error.warn

    Hi All, Is there any analogue of the adf.error.warn, that used in groovy expression, but for calling from java validation method of EO, and with an opportunity to set custom message text(not message id)? Thanks!