Skip to Content

what if OTR texts in JS contains " ?

I have a BSP page that contains the following

<script...>
alert("<%otr(ITSM/mytext)%>");
</script>

I the original language, the text was i.e. "Wrong value in field 'printer'!". But unfortunately, the translators changed the 's to "s in some languages.

Ok, I could tell the translators to use single quotes instead of doubled or to use \", but I don't want to bother them with JS specifics. Is there a better way to assure that an OTR text doesn't contain characters that JS can't handle?

Add a comment
10|10000 characters needed characters exceeded

Related questions

3 Answers

  • Best Answer
    Posted on Dec 15, 2004 at 09:30 AM

    Try the following code. It worked for me.

    [code]

    <%@page language="abap" %>

    <%@extension name="htmlb" prefix="htmlb" %>

    <%@extension name="phtmlb" prefix="phtmlb" %>

    <htmlb:content design="design2003" >

    <htmlb:page title="Main page " >

    <htmlb:form>

    <script>

    <%

    data: otr_string type string.

    otr_string = page->OTR_TRIM( '$TMP/mytext' ).

    %>

    alert("<%= cl_bsp_utility=>encode_string( in = otr_string encoding = if_bsp_writer=>co_javascript ).%>");

    </script>

    </htmlb:form>

    </htmlb:page>

    </htmlb:content>

    [/code]

    Add a comment
    10|10000 characters needed characters exceeded

  • Posted on Dec 15, 2004 at 09:05 AM

    Maybe write yourself a function for your application that wraps around the otr-text include and does javascript-safe character-replacement.

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Dec 15, 2004 at 09:06 AM

    Try loading the text into a variable and then manipulating it ???

    Just a random thought.

    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.