How to decode encoded string for javascript

This is encoded HTML code to be used at javascript function
<div class=\"ProductDetail\"><div style=\"width:780px\">\r\n\t<div class=\"baslik\" style=\"margin: 0px; padding: 5px 10px; border-width: 5px 0px 1px; border-top-style: solid; border-bottom-style: solid; border-top-color: rgb(255, 255, 255); border-bottom-color: rgb(153, 165, 165); vertical-align: baseline; color: rgb(0, 0, 0); clear: both; line-height: 14px; font-family: 'Lucida Grande', sans-serif; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; background-color: rgb(219, 223, 226);\"> Di\u011fer \u00d6zellikler<\/div><\/div><\/div>
When decoded properly it becomes below
<div class="ProductDetail"><div style="width:780px">
<div class="baslik" style="margin: 0px; padding: 5px 10px; border-width: 5px 0px 1px; border-top-style: solid; border-bottom-style: solid; border-top-color: rgb(255, 255, 255); border-bottom-color: rgb(153, 165, 165); vertical-align: baseline; color: rgb(0, 0, 0); clear: both; line-height: 14px; font-family: 'Lucida Grande', sans-serif; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; background-color: rgb(219, 223, 226);"> Diğer Özellikler</div></div></div>
This website has both decode and encode features
http://www.freeformatter.com/javascript-escape.html#ad-output
I could find HttpUtility.JavaScriptStringEncode at c# however i couldn't find any function class etc to decode encoded string
So i need help about how to decode like that website does
.net 4.5 c#
Browser based Pokemon Style MMORPG Game Developer Used asp.net 4.0 routing at it's
Monsters

Hi
Monster,
For web questions related to ASP.NET use the
ASP.NET forum
You should get more, better and faster answers on the other forum.  Thanks, ahead of time.
Thanks
We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
Click
HERE to participate the survey.

Similar Messages

  • Escaping a string for Javascript

    Hi!
    I've been using a lot of time on how to escape special characters in order for Javascript to accept a string. It seems like I need to escape single quotes, double quotes, backslash and newline.
    I've written some code, but I just can't get it to work.
    public static String editorSafeFilter(String text)
            if(text == null){
                return null;
            StringBuffer buffer = new StringBuffer(text.length());
             for (int i = 0; i < text.length(); i++) {
                char ch = text.charAt(i);
                 switch (ch) {
                   case 10: // '\n'
                        buffer.append(" ");
                        break;
                    case 13:
                         buffer.append(" ");     // '\r'
                         break;
                    case '\'':
                        buffer.append('\\');
                        buffer.append("\'");
                        break;
                    case '"':
                        buffer.append('\\');
                        buffer.append('\"');
                        break;
                    case '\\':
                        buffer.append('\\');
                        buffer.append('\\');
                        break;
                    default :
                        buffer.append(ch);
                        break;
            return buffer.toString();
        }Anyone have any links or sample code that works?
    thanks!
    Vidar

    It looks like you want the actual escape sequences... public static String editorSafeFilter(String text)
            if(text == null){
                return null;
            StringBuffer buffer = new StringBuffer(text.length());
             for (int i = 0; i < text.length(); i++) {
                char ch = text.charAt(i);
                 switch (ch) {
                   case '\012': // '\n'
                        buffer.append("\\n");     // '\n'
                        break;
                    case '\015':
                        buffer.append("\\r");     // '\r'
                        break;
                    case '\'':
                        buffer.append("\\\'");
                        break;
                    case '\"':
                        buffer.append("\\\"");
                        break;
                    case '\\':
                        buffer.append("\\\\");
                        break;
                    default :
                        buffer.append(ch);
                        break;
            return buffer.toString();
        }

  • How to change connection string for a form created with b1de

    Hi all
    i've created a form using the Code Generator tool ob B1DE
    My question is how can i set the connection string to a different server and database. doing so after the creation wizard has finished?

    Hi,
    Why do you need to change the connection string? What are you calling "connection string for a form"???
    The only connection string I now about is the one used to connect to the UI API... and this one is fixed for all apps in debug mode and given as parameter when your addon is registered in B1.
    The connection string is filled in the code of your generated addon.
    Please go to the main class of your addon, in the main method you have the following code where the connection string is filled either with the command line parameters (release mode) or with the fixed value given by SAP. This code doesn't need to be changed...
            public static void Main()
                int retCode = 0;
                string connStr = "";
                bool diRequired = true;
                // CHANGE ADDON IDENTIFIER BEFORE RELEASING TO CUSTOMER (Solution Identifier)
                string addOnIdentifierStr = "";
                if ((System.Environment.GetCommandLineArgs().Length == 1)) {
                    connStr = B1Connections.connStr;
                else {
                    connStr = System.Environment.GetCommandLineArgs().GetValue(1).ToString();
                try {
                    // INIT CONNECTIONS
                    retCode = B1Connections.Init(connStr, addOnIdentifierStr, diRequired);
    Regards
    Trinidad.

  • How To Split the String for "."

    Hi Friends
    I am Using Following Code to Split one String.
    String str = "Jeetendra.choudhary";
    String[] sp_str = str.split(".");
    wdComponentApi.getMessageManager.reportSuccess(str[0]);
    wdComponentApi.getMessageManager.reportSuccess(str[1]);
    but its throwing null pointer exception. 
    when i am using following code its working fine.
    String str = "Jeetendra/choudhary";
    String[] sp_str = str.split("/");
    wdComponentApi.getMessageManager.reportSuccess(str[0]);
    wdComponentApi.getMessageManager.reportSuccess(str[1]);
    what may be the issue and how to split the string with "." ?
    Thanks & Regards
    Jeetendra

    "." is a special character.
    Use
    str.split("\\.");
    Regards
    Benjamin
    Edited by: Benjamin Hansen on Dec 29, 2009 7:52 AM

  • How to create XML string for an object matching the result of a marshal?

    I'm trying to create a XML string representation of an object which exactly matches the XML which results from marshalling the object into a request. I'm almost there except that the XML string I come up with is missing the attribute "standalone=\"yes\"" in the topmost xml element, and this attribute is present in the marshalled XML. I'm using the XML string to create a payload signature which must match exactly with the XML payload of the request, so the two XML representations of the object really do need to be identical.
    Here's what I'm doing to create the XML from the object:
       private String myObjectToXmlString (final MyObject myObject)
           throws Exception {
                 try {
               DocumentBuilder documentBuilder = documentBuilderFactory.newDocumentBuilder();
               Document document = documentBuilder.newDocument();
               myObjectMarshaller.marshal(myObject, document);
               Source source = new DOMSource(document);
               StringWriter stringWriter = new StringWriter();
               Result result = new StreamResult(stringWriter);
               TransformerFactory factory = TransformerFactory.newInstance();
               Transformer transformer = factory.newTransformer();
               transformer.transform(source, result);
               return stringWriter.getBuffer().toString();
           } catch (Exception ex) {
               throw new Exception("Unable to convert a MyObject object to an XML String -- " + ex.toString(), ex);
       }The XML which is produced looks like this:
    <?xml version=\"1.0\" encoding=\"UTF-8\"?>
    <ns2:myObject xmlns:ns2=\"http://sunconnection.sun.com/xml\">
       <myObjectId>0</myObjectId>
       <objectType>1</objectType>
       <description>Test Object</description>
    </ns2:myObject>The payload object is marshalled to the request like so:
        // marshall the MyObject to the output stream
       OutputStream outputStream = myHttpUrlConnection.getOutputStream();
       myObjectMarshaller.marshal(myObject, outputStream);
       outputStream.flush();
       outputStream.close();When I view the XML payload of the request it looks like this:
    <?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?>
    <ns2:myObject xmlns:ns2=\"http://sunconnection.sun.com/xml\">
       <myObjectId>0</myObjectId>
       <objectType>1</objectType>
       <description>Test Object</description>
    </ns2:myObject>As you can see the two XML representations of the object are identical except for the standalone attribute in the xml element.
    It'd be a hack to make the assumption that the standalone attribute will always be there in the marshalled object and to just hard code it into the XML string returned by my object to XML method. Since I'm using the same Marshaller to create the XML string as I am to perform the marshalling to the request I assume that there's some way to make it give the same XML in both cases, and that I'm doing something wrong in my method which converts the object to an XML string. If anyone can see where I'm going wrong in that method (myObjectToXmlString() above), or can suggest a better way of doing this, then I'll certainly appreciate the insight.
    --James                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       

    It turns out that I was taking the wrong approach in my object to XML string method. A cleaner/better way to do it, which gives the correct result, is this:
        private String myObjectToXmlString (final MyObject myObject)
            throws Exception {
            try {
                ByteArrayOutputStream stream = new ByteArrayOutputStream();
                myObjectMarshaller.marshal(myObject, stream);
                return stream.toString();
            } catch (Exception ex) {
                throw new Exception("Unable to convert a MyObject object to an XML String -- " + ex.toString(), ex);
        }--James                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       

  • How to use destination function for javascript

    Hi,
    I used javascript:var a = window.open('OA.jsp?page=/oracle/apps/cdar/admin/brandupload/webui/SupportPG&retainAM=Y&OARF=printable', 'a','height=500,width=900,menubar=yes,toolbar=yes,location=yes'); a.focus(); in destination URL property, it can work to popup another window.
    But I want to setup a Oracle function for this javascript, and use Destination FUNC property on the button to popup window. But it can not work after I setup a SSWA jsp function with WEB HTML.
    Could some one help this?
    Thanks,
    Eileen

    Eileen,
    How are you adding the OA function ? I have also tried destination url property but not the destination function.Probably you should do sth like this :
    In ProcessRequest :-
    <OABean> <var name> = (<OABean>)webBean.findChildRecursive("<Bean Id>");
    <var name>.setOnClick("javascript:window.open ('OA.jsp?OAFunc=<funcName>','new','height=550,width=850,status=yes,scrollbars=yes,toolbar=no,menubar=no,location=no' );
    OABean is the bean on click of which the page should open like a hyperlink or sth like that.
    Hope this helps.

  • How to error check string for LONG list of strings

    Hi All,
    Let's say I want to compare a string variable with a long list of strings to see if it matches anything in that list. Is there some built-in function that will make this easy. Or should I do it the old fashioned way and load a string array with the list and then for loop through the array comparing each element?
    Cheers,
    ScKaSx

    ScKaSx wrote:
    I'm alittle weak at using interfaces. If the string I am trying to compare is (String grade), then how do I define my List to be ("A+", "A", "A-", "B+", "B", "B-", "C+", "C", .....). This is as far as I've got:
    String grade = 'some letter to be compared'
    String [] GradeList = new String [] {"A+", "A", "A-", "B+", "B", "B-", "C+", "C", .....};Maybe I could summarize what I meant using your example:
    Set<String> PossibleGrades = new HashSet();
    PossibleGrades.add("A+");
    PossibleGrades.add("C");
    String grade = "some letter to be compared";
    if(PossibleGrades.contains(grade) )
       // do something...
    }

  • How do i use variables for javascript pop up window?

    hi,
    i want to open a popup window from flash,
    as advised before i used this line :
    getURL("javascript:NewWindow=window.open('imylink.html','title','width=890,height=660,left =10,top=5,toolbar=No,location=No,scrollbars=Yes,status=No,resizable=Yes,fullscreen=No');
    void(0);");
    BUT, in flash, the URL that has to be open as do the height
    and wdth are stored as variable... imageURL, imageWidth,
    imageHeight, since i have quite a few different pages that have to
    open and they change. how can i use the values of the variables in
    the javascript code??
    is it possible at all?

    try:

  • How to split a string for 2 different matching patterns?

    hey guys
    i'm trying to split a string, using .split(regular expression), if two different pattern matches but i don't know the exact syntax for it. I want to split the string from letters and punctuations.
    This is what i'm doing, obviously it's not working, i'm not too sure if syntax are correct.
    String inputDigit [] = input.split("([a-zA-Z]) (\\p{Punct})");Please help me with this, thank you!

    Can you describe in more detail what you're trying to
    accomplish?ok, basically if you have a string which consists of letters, digits and punctuations. All i'm trying to do or want to do is store all digist within that string into an array. Therefore, i'm using split method to split the string wherever you find a letter or a punctuation. But i don't know what is syntax for using two different patterns at the same time.
    // For example if you have a string "Eeyore 61 2.986PoohPiglet007Kanga-23"
    // i only want: 61 2 986 007 23. I know i can use substring // but that would be a slightly long process

  • How to use Unicode strings for tool titles?

    So one of the few remaining Illustrator suites that does not accept ai::UnicodeString objects for arguments is AIToolSuite. I would really (really!) like to get some Unicode characters in some of my tool titles and tips, but figuring out what goes on behind the sAITool->AddTool() call, with its char* arguments, is tough.
    I have tried the obvious stuff, like passing UTF-8 multibyte data, which doesn't work. I have tried more nebulous approaches, like passing Z-string data with Adobe's strange way of "escaping" Unicode code points (they typically use "^U+1234" instead of the de facto "\u1234"), which doesn't work either.
    The result is that Unicode data either doesn't show at all, or shows as the typical Latin-based garbage full of diacritical marks (e.g. "éáÊöãÀ") which is nowhere near the original data that was passed in.
    Anybody have some insight?
    PS: I plan on filing a feature request shortly for ai::UnicodeString support in AIToolSuite, but until then...
    Thanks,
    - Garrett

    Hello Mark -
    At this time TestStand has no unicode support. The multi-byte support that we do offer is based on the Windows architecture that handles Asian language fonts. It really isn't meant to provide a bridge for unicode values in TestStand. Certainly, your Operator Interface environment will have its own support level for unicode, i.e. at this time neither LabWindows/CVI version 6.0 nor LabVIEW 6.1 officially support unicode characters. This is why you will see that the units defined in the TestStand enumerators are all text-based values.
    I have run a quick test here, probably similar to what you were doing on your end, and I am uncertain if you will get the database behavior you want from TestStand. The database logging steps and API all use basic char sty
    le strings to communicate to the driver. Even though you are reading in a good value from Excel, TestStand is interpreting the character as the nearest ASCII equivalent, i.e. "Ω" will be stored and sent to the database as "O". If you have a stored proceedure in Oracle that is calling on some TestStand variable or property string as an input, then it is doubtful you will get correct transmission of the values to the database. If your stored proceedure could call into a spreadsheet directly, you would probably have better luck.
    Regards,
    Elaine R.
    National Instruments
    http://www.ni.com/ask

  • How to make search string for the searched text containing single quote?

    Hi all,
    When trying to search some Contacts from Eloqua, I have to make a search string which would list out some specified EmailAddress.
    Unfortunately, I meet several emails who have single quote in their spelling.
    I got 'invalid format' error when both using them directly and making single quote twice.
    Any suggestions?
    Thanks,
    Biao

    When testing, the following examples:
    GET /Api/rest/1.0/data/contacts?search=emailAddress=bm'[email protected]
    GET /Api/rest/1.0/data/contacts?search='emailAddress=bm'[email protected]'
    GET /Api/rest/1.0/data/contacts?search=emailAddress="bm'[email protected]"
    GET /Api/rest/1.0/data/contacts?search="emailAddress=bm'[email protected]"
    All return:
      "elements":
        "type":"Contact",
        "id":"1421620",
        "createdAt":"1419611518",
        "depth":"minimal",
        "name":"bm'[email protected]",
        "updatedAt":"1419611519",
        "emailAddress":"bm'[email protected]"
      "page":1,
      "pageSize":1000,
      "total":1
    Likewise, the following returns nothing:
    GET /Api/rest/1.0/data/contacts?search=emailAddress='bm'[email protected]'
    Hopefully this helps,
    Bojan

  • How to generate accesskey string for parent-to-child buttons using JHeadsta

    Dear All,
    I've tried to generate detail buttons with access key functionality. When I prefix an ampersand to the 'Display Title (plural)' property of a (detail) group in the JHeadstart application definition, access key functionality is generated for the parent-to-detail buttons.
    The same property, however, is used for the Table title, so that the '&' appears in the title. This is not desirable.
    Is there any other way?
    Many thanks,
    Ibrahim

    Dear All,
    I found a way to achieve this, so please disregard this post.
    My apologies for the inconvenience.
    Regards,
    Ibrahim

  • How to set encoding type for e4x result

    I have a application with front end Flex and Server side App
    in Java. I am using HttpService to communicate to Java application
    (Web). I am sending data in xml format to flex and parsing it as
    e4x format. From service side I am setting the charset as
    windows-1252 and xml encoding is also windows-1252. In Flex I am
    getting some junk characters. But When I post the same http request
    from browser, I am able to view the characters with expected
    encoding.
    Can anybody clue me on getting xml data in required encoding
    type (charset) in Flex.
    Thanks in Advance,
    Gokul Ram.T

    The message is old, but the problem is opened and I believe that many people have troubles with getting appropriate encoding in e4x result.
    I have excactly same problem like Gokul, only difference is that I am trying to get ISO-8859-2 charset. HttpService deffinition looks like this:
    var source:HTTPService = new HTTPService();
    source.method = "POST";
    source.resultFormat = "e4x";
    source.contentType = "text/xml; charset=ISO-8859-2";
    source.headers = {"Content-Type": "text/xml; charset=ISO-8859-2"};
    So I suppose that everything what can be set is set. But still in result XMLthere are no national chars. I also get correct XML when I request it in browser, but requesting by Flex and HttpService makes problem.
    Does anyone have same problem and find out something to handle this?

  • How to get Connection string for Sql Server Installed ( using Gallary ) on Azure VM ?

    Installed Azure VM From gallary with Sql Server 2012, even after allowing 1433 port through firewall, still cant get access to Sql Server from outside vm, So please provide steps for getting exact ServerName for connecting Sql Server on VM for connecting
    from Visual Studio Application.
    Thanks.

    Hi,
    You can check the DNS name of the VM in the VM instance page of the Azure management portal.
    In addition, you can also refer to the third-party article below:
    http://thomaslarock.com/2014/02/connect-to-a-windows-azure-vm-using-sql-server-management-studio/
    ( Note: Microsoft is providing this information as a convenience to you. The sites are not controlled by Microsoft. Microsoft cannot make any representations regarding the quality, safety, or suitability of any software or information found there. Please
    make sure that you completely understand the risk before retrieving any suggestions from the above link.)
    Best regards,
    Susie
    Please remember to mark the replies as answers if they help and unmark them if they provide no help. If you have feedback for TechNet Subscriber Support, contact [email protected]

  • How to encode sql string for SQL Server when using JDBC?

    in code, dynamically generate sql stirng like:
    String sqlstring = "select column from table where column=' " + var + " ' ";
    Question is: if var include char ' , it will cause error becuase ' is reserved by SQL Server for string reference.
    So how to encode string for dynamic sql string? for example, following sql(when var =" I'm tester"):
    select column from table where column like ' I'm tester '
    Edited by: KentZhou on Jun 17, 2009 3:10 PM

    Use PreparedStatement. Use it all the way. It not only saves you from SQL injections, but also eases setting non-standard Java objects like Date and InputStream in a SQL statement.
    Prepare here: [http://java.sun.com/docs/books/tutorial/jdbc/basics/prepared.html].

Maybe you are looking for