URL Encoding and UTF8

Hello Friends,
I have been working on this problem for some time now. I have a web page that has forms fields like first name, last name etc. and then posts the data back to a servlet that writes it into a file that is utf-8 encoded. The web page has charset specified as utf-8. I was assuming that data would be sent back in the url as utf-8. I entered some japanese data copied from a japanese web page. When I looked at the file into which the form data was written I saw that it wasn't even close to utf-8 or unicode encoding of the data I had posted. For eg. I entered a japanese character: '\u4F1A' which is utf-8 encoded as 'E4 BC 9A'. But the data written into the file is '25 45 34 25 42 43 25 39 41'. This is of course because the data is url encoded which is '%E4%BC%9A', since 45 is hex for E, 34 is hex for 4 and so on. Now the question is how is it that I proceed to get the right utf data back. I am using a jrun server. Is there something that I need to set here in order to get the right characters back.

The UTF-8 encoded sequence of bytes of the character '\u4F1A' is {-E4, -BC, -9A}, and the character '-' is (char)0x2d instead of (char)0x25. And I suppose 25 should be 2d.

Similar Messages

  • URL Encoding and Decoding in OSB

    Hi,
    Do we have out-of-box solution in OSB to decode XML which is URL encoded and encode XML to URL encoding. If so how can I do it.
    This might be basic question. I am unable to figure out. new to OSB.
    Thanks
    Sham.

    Hi Sham,
    Probably these are what you looking for...
    fn-bea:inlinedXML()
    fn-bea:serialize()
    fn-bea:serialize() to represent an XML document as a string
    fn-bea:inlinedXML() to parses textual XML and returns an instance of the XQuery 1.0 Data Model.
    Supported Function Extensions from Oracle
    http://docs.oracle.com/cd/E23943_01/admin.1111/e15867/xquery.htm#i1101407
    Oracle’s XQuery Implementation
    http://docs.oracle.com/cd/E13162_01/odsi/docs10gr3/xquery/extensions.html
    Cheers,
    Vlad
    It is considered good etiquette to reward answerers with points (as "helpful" - 5 pts - or "correct" - 10pts)
    https://forums.oracle.com/forums/ann.jspa?annID=893

  • URL Encode and Decode

    Hi Experts,
    My Oracle Version:
    BANNER                                                                         
    Oracle Database 11g Enterprise Edition Release 11.1.0.7.0 - Production         
    PL/SQL Release 11.1.0.7.0 - Production                                         
    CORE     11.1.0.7.0     Production                                                     
    TNS for 32-bit Windows: Version 11.1.0.7.0 - Production                        
    NLSRTL Version 11.1.0.7.0 - Production                                         
    5 rows selected.I got the requirement to check any URL encode and decode methods available in common for O racle and PHP,
    Since URL will be encoded in database at the time of retreiving data from database but it will be decoded in PHP without db connection.
    Hope my scenario will be clear to you, is any common function available in oracle and php for this process?

    but escape, unescape just adds %20 for empty space in the URLwell it does a bit more: it escapes all special characters that should not be in a URL, e.g.
    SQL> select utl_url.escape('#^|%µ ') escaped_url from dual
    ESCAPED_URL                                                                    
    %23%5E%7C%25%B5%20                                                             
    1 row selected.Can you give an example of how you want a completely converted url, and why?

  • Url Encoding and decoding

    Hi All,
    I am trying to encode the url, pass spme parameters and decode them in another jsp.
    Encoding:
    <a href="<c:url value="abc.jsp">
                        <c:param name="folder" value="${sectionValue.foldername}"/>
                        <c:param name="filen" value="${fn:trim(sectionValue.filelink)}"/>
                        </c:url>"
                        target="_blank">${sectionValue.filename} (${sectionValue.filetype})</a>Decoding in abc.jsp
    <%
    out.clear();
         out = pageContext.pushBody();
         String path ="E:\\web\\forms\\Current\\";
         String folder = request.getParameter("folder");
         String filen = URLDecoder.decode(request.getParameter("filen"), "UTF-8");
         path=path+folder+"\\"+filen;
         System.out.println(path);
    %>When I print this path, it still is T L Fam12.19.08.pdf instead of T + L Fam12.19.08.pdf.
    It is encoding correctly , cause it is T%2bL%2520Fam12.19.08.pdf
    Thanks

    It is encoding correctly , cause it is T%2bL%2520Fam12.19.08.pdfIt looks like at least part of it has been encoded twice.
    %25 decodes to a % sign.
    So it would have been encoded once, space converts to %20
    Encoded a second time %20 --> %2520 (encodes the % sign)
    What is the value of "${sectionValue.filelink}" that you are encoding?
    Does it already have the %20 in it?

  • Url encoding and getUrl

    I've created a flash search widget that needs to use the
    google clickTag. It works fine if I search with one term. But if I
    search for two terms, the resulting url is
    ...com/search/term1%20term2. For Google tracking, this needs to be
    the '+' character. Here is the actionscript:
    on (release, keyPress "<Enter>")
    if (the_text != "" && the_text != undefined)
    getURL(_root.clickTag + "/search/" + the_text, _blank);
    } // end if
    I saved as flash player 8 and tried in both AS1.0 and AS2.0.
    Any suggestions out there for solving this?
    cwseattle

    Hi Sham,
    Probably these are what you looking for...
    fn-bea:inlinedXML()
    fn-bea:serialize()
    fn-bea:serialize() to represent an XML document as a string
    fn-bea:inlinedXML() to parses textual XML and returns an instance of the XQuery 1.0 Data Model.
    Supported Function Extensions from Oracle
    http://docs.oracle.com/cd/E23943_01/admin.1111/e15867/xquery.htm#i1101407
    Oracle’s XQuery Implementation
    http://docs.oracle.com/cd/E13162_01/odsi/docs10gr3/xquery/extensions.html
    Cheers,
    Vlad
    It is considered good etiquette to reward answerers with points (as "helpful" - 5 pts - or "correct" - 10pts)
    https://forums.oracle.com/forums/ann.jspa?annID=893

  • URL encoded and refreshing the current page

    Hello, I am redirecting to a page using response.sendRedirect(encodedPage). In the page which I redirect to, I have some code that checks if certain session variables are set. Upon redirection, all the session variables are set. However, if I hit the refresh button on my browser, the session check code tells me the variables are no longer set. Is this supposed to happen?
    Any help would be appreciated.
    jason

    My suggestion probably has nothing to do with the
    problem, but when you encode the URL for your
    sendRedirect() call, are you using encodeURL()?
    Because you should be using
    encodeRedirectURL().
    I am using encodeRedirectURL :) .... thanks for the suggestion though.

  • How to detect encoding file in ANSI, UTF8 and UTF8 without BOM

    Hi all,
    I am having a problem with detecting a .txt/.csv file encoding. I need to detect a file in ANSI, UTF8 and UTF8 without BOM but the problem is the encoding of ANSI and UTF8 without BOM are the same. I checked the function below and saw that ANSI and UTF8
    without BOM have the same encoding. so, How can I detect UTF8 without BOM encoding file? because I need to handle for this case in my code.
    Thanks.
    public Encoding GetFileEncoding(string srcFile)
                // *** Use Default of Encoding.Default (Ansi CodePage)
                Encoding enc = Encoding.Default;
                // *** Detect byte order mark if any - otherwise assume default
                byte[] buffer = new byte[10];
                FileStream file = new FileStream(srcFile, FileMode.Open);
                file.Read(buffer, 0, 10);
                file.Close();
                if (buffer[0] == 0xef && buffer[1] == 0xbb && buffer[2] == 0xbf)
                    enc = Encoding.UTF8;
                else if (buffer[0] == 0xfe && buffer[1] == 0xff)
                    enc = Encoding.Unicode;
                else if (buffer[0] == 0 && buffer[1] == 0 && buffer[2] == 0xfe && buffer[3] == 0xff)
                    enc = Encoding.UTF32;
                else if (buffer[0] == 0x2b && buffer[1] == 0x2f && buffer[2] == 0x76)
                    enc = Encoding.UTF7;
                else if (buffer[0] == 0xFE && buffer[1] == 0xFF)
                    // 1201 unicodeFFFE Unicode (Big-Endian)
                    enc = Encoding.GetEncoding(1201);
                else if (buffer[0] == 0xFF && buffer[1] == 0xFE)
                    // 1200 utf-16 Unicode
                    enc = Encoding.GetEncoding(1200);
                return enc;

    what you want is to get the encoding utf-8 without bom which can only be detected if the file has special characters, so do the following:
    public Encoding GetFileEncoding(string srcFile)
                // *** Use Default of Encoding.Default (Ansi CodePage)
                Encoding enc = Encoding.Default;
                // *** Detect byte order mark if any - otherwise assume default
                byte[] buffer = new byte[10];
                FileStream file = new FileStream(srcFile, FileMode.Open);
                file.Read(buffer, 0, 10);
                file.Close();
                if (buffer[0] == 0xef && buffer[1] == 0xbb && buffer[2]
    == 0xbf)
                    enc = Encoding.UTF8;
                else if (buffer[0] == 0xfe && buffer[1] == 0xff)
                    enc = Encoding.Unicode;
                else if (buffer[0] == 0 && buffer[1] == 0 && buffer[2]
    == 0xfe && buffer[3] == 0xff)
                    enc = Encoding.UTF32;
                else if (buffer[0] == 0x2b && buffer[1] == 0x2f &&
    buffer[2] == 0x76)
                    enc = Encoding.UTF7;
                else if (buffer[0] == 0xFE && buffer[1] == 0xFF)
                    // 1201 unicodeFFFE Unicode (Big-Endian)
                    enc = Encoding.GetEncoding(1201);
                else if (buffer[0] == 0xFF && buffer[1] == 0xFE)
                    // 1200 utf-16 Unicode
                    enc = Encoding.GetEncoding(1200);
               else if (validatUtf8whitBOM(srcFile))
                    enc = UTF8Encoding(false);
                return enc;
    private bool validateUtf8whitBOM(string FileSource)
                bool bReturn = false;
                string TextUTF8 = "", TextANSI = "";
                //lread the file as utf8
               StreamReader srFileWhitBOM  = new StreamReader(FileSource);
               TextUTF8 = srFileWhitBOM .ReadToEnd();
               srFileWhitBOM .Close();
                //lread the file as  ANSI
               StreamReader srFileWhitBOM  = new StreamReader(FileSource,Encoding.Defaul,false);
               TextANSI  = srFileWhitBOM .ReadToEnd();
               srFileWhitBOM .Close();
               // if the file contains special characters is UTF8 text read ansi show signs
                if(TextANSI.Contains("Ã") || TextANSI.Contains("±")
                     bReturn = true;
                return bReturn;

  • Sending document to oracle xml gateway web service and body is url encoded

    Hello,
    a question from a complete newbie to web services. I have some code that is sending a soap message to an oracle xml gateway web service. In the soap message the values in the soap body look like &lt ;CNTROLAREA&gt ;
    when I would be expecting <CNTROLAREA>. What I have been told is that the content of the ReceiveDocument element has been url encoded which causes the &lt and to correct it I need to change the paramater type from object to xmlnode and to build the request as an xmldocument. The xmlnode and xmldocument comes from a .net guy so I've been trying to find the equivalent in java but am not having any luck. I have a lot of reading to do but was wondering if someone might be able to point me in the right direction on how to correct the problem. I captured the soap message being sent using tcpmon. Why does the body have the &lt instead of the < as I was expecting and is there an xmldocument type? The header part of the soap message looks as I expect. "><soapenv:Header><ns1:XMLGateway_Header xmlns:ns1="http://xmlns.oracle.com/apps/fnd/XMLGateway"><ns1:MESSAGE_TYPE>XML</ns1:MESSAGE_TYPE>. It is being sent as a com.oracle.xmlns.apps.fnd.XMLGateway.XMLGateway_Header type.
    thanks
    Thanks
    Edited by: twf123 on May 5, 2010 11:59 AM
    Edited by: twf123 on May 5, 2010 12:00 PM

    twf123 wrote:
    What I have been told is that the content of the ReceiveDocument element has been url encoded which causes the &lt and to correct it I need to change the paramater type from object to xmlnode and to build the request as an xmldocument. Where do you change the parameter type?
    The xmlnode and xmldocument comes from a .net guy so I've been trying to find the equivalent in java but am not having any luck. How do you get the data from .net guy? Which interface do you use? What processing do you do after receiving the data?

  • XSL and url encoded data issue

    I have a large XML document, which has the data in it URLEncoded to escape the nasty chars.
    When I run it through the xalan XSL parser and feed the output to the browser in my servlet, the resultant html has the URLEncoded chars in it. For instance the '/' is still showing up at %2F etc... However, if I can't URLDecode the whole xml document. Is there a simple way for decode the URL chars, without doing too much trickery?
    Thanks!
    Modoc

    You can URL-encode XML data if you like, whatever you mean by "nasty chars" I don't know. The result is perfectly legitimate XML and XSLT will translate it perfectly well. But it won't decode it, that is none of its business. I suppose it would be possible to write an XSLT function to do URL-decoding, but my preference would be to do that some other way. Or not to URL-encode in the first place.

  • Guestname coming from session, not from parameter, and it's URL-encoded. Need it decoded.

    We have a hosted account for Adobe Connect. When users want to enter a room, they go to a URL like this:
    http://connectpro12345678.na5.acrobat.com/rereview/?launcher=false&guestName=John%20Smith
    This drops them into the meeting room, but the name is listed under Participants as
    John%20Smith
    rather than the desired John Smith.
    I've determined that the URL-encoded name is coming from the session, because when I deleted the BREEZESESSION cookie and hit the meeting room directly, using a URL like:
    https://connectpro12345678.adobeconnect.com/_a963369417/rereview/?launcher=false&guestName =Michael%20Van%20Kleeck
    the guest name is displayed appropriately.
    How can I force Connect to either decode the guestname or to use the guestname from the parameter, rather than the session?
    Thanks!
    -Michael

    You shouldn't be using the naX.acrobat.com URLs. These URLs are redirecting to the new adobeconnect.com URLs, which may be where you are seeing the issues. You shouldn't need to use your account ID (_a963369417) so your links should look like: http://connectpro12345678.adobeconnect.com/review/?launcher=false&guestName=John%20Smith

  • Code for URL Encoder-Decoder!!!

    This is the code to Encode and Decode URL...Any suggestions on this are welcome...
    public class UrlEncoderDecoder
    public UrlEncoderDecoder()
    // TODO: Add constructor logic here
    // http://www.infysolutions.com
    public static string TamperProofStringEncode(string value, string key)
    System.Security.Cryptography.MACTripleDES mac3des = new System.Security.Cryptography.MACTripleDES();
    System.Security.Cryptography.MD5CryptoServiceProvider md5 = new System.Security.Cryptography.MD5CryptoServiceProvider();
    mac3des.Key = md5.ComputeHash(System.Text.Encoding.UTF8.GetBytes(key));
    return Convert.ToBase64String(System.Text.Encoding.UTF8.GetBytes(value)) + '-' + Convert.ToBase64String(mac3des.ComputeHash(System.Text.Encoding.UTF8.GetBytes(value)));
    public static string TamperProofStringDecode(string value, string key)
    string dataValue = "";
    string calcHash = "";
    string storedHash = "";
    System.Security.Cryptography.MACTripleDES mac3des = new System.Security.Cryptography.MACTripleDES();
    System.Security.Cryptography.MD5CryptoServiceProvider md5 = new System.Security.Cryptography.MD5CryptoServiceProvider();
    mac3des.Key = md5.ComputeHash(System.Text.Encoding.UTF8.GetBytes(key));
    // http://www.infysolutions.com
    try
    dataValue = System.Text.Encoding.UTF8.GetString(Convert.FromBase64String(value.Split('-')[0]));
    storedHash = System.Text.Encoding.UTF8.GetString(Convert.FromBase64String(value.Split('-')[1]));
    calcHash = System.Text.Encoding.UTF8.GetString(mac3des.ComputeHash(System.Text.Encoding.UTF8.GetByte s(dataValue)));
    if (storedHash != calcHash)
    throw new ArgumentException("Hash value does not match");
    catch
    throw new ArgumentException("Invalid TamperProofString");
    return dataValue;

    Ritu,
    Split the webpage into two frames.
    Frame1: Dropdown that you will dynamically populate. This will have to be coded using http://help.sap.com/saphelp_nw04/helpdata/en/09/9c0e41a346ef6fe10000000a1550b0/content.htm.
    Next insert java script into your page so that when one of these links is selected, specifically the onChange event, the other frame gets refreshed with the webpage that you would like to have. This page gives a good example of onChange.
    http://docs.sun.com/source/816-6408-10/checkbox.htm
    Best.
    Sumit.

  • Newbie ERROR- URL Encoded SQL Length exceeds allowed 32K limit

    My SQL Query worked fine yesterday.( I'm still in developing mode)
    I made a copy of it and put it into a text file.( Just to be sure I had it.)
    Today When I tried to run it in APEX , I get error
    URL Encoded SQL Length exceeds 32K limit.
    Is there any way to tell how the size of my query ( for example 33K)
    is using?
    TIA
    Steve42

    I had to put out some other fires for the last few days.
    I'm trying to use it in SQL worksheet.
    That is my entire error message. It does NOT have an Error #.
    Product Build: 3.0.0.00.20
    TIA,
    Steve42

  • XML to URL Encoded (XSLT?)

    I have some data in a Document object and need to convert it to URL encoded format so, for example this:
    <share>
    <code>GSK</code>
    <price>13.34</price>
    </share>
    becomes something like...
    &code=GSK&price=13.34& ...
    I've been looking into doing this with XSLT but have run into difficulties. Do you think this is the best way of solving this problem, or is there another easier way?
    Thanks.

    I did something similar, basically takes a incoming XML file and output a HTML with certain link containing XML element value as query string. One of the things you have to be careful is, like Dr. Clap mentioned, to properly encode the value. I accompolished by using java extension in my XSL.
    For example:
    <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
              xmlns:encode="java.net.URLEncoder"
              extension-element-prefixes="encode"
              version="1.0">
         <xsl:template match="/">
              <xsl:variable name="myURL" select="concat('?blah=', encode:encode($myValueFromXML))" >
         </xls:template>
    </xsl:stylesheet>

  • Apache plugin url encoding

    the following is on HP Apache-based Web Server/1.3.26
    with the mod_wl.so from 6.1 sp3 proxying to a 6.1 sp3 backend and I tried setting
    up QueryFromRequest ON to no avail.
    I am having the following problem with the BEA proxy plugin for Apache. I have
    a very simply scenario to demonstrate it. Lets say that you have the following
    directory/file structure:
    /applications
         /DefaultWebApp
              spaceLink.htm
              /space demo
                   resource.htm     
    NOTE: There is a "space" in the "space demo" directory name.
    Now, spaceLink.htm has a link to the file resource.htm in the "space demo" directory.
    Here is the html:
    <html> <body> click here </body> </html>
    Now assume that apache is sitting in front of this BEA box and proxying requests
    to the BEA box.
    If the Apache-BEA proxy plugin is proxying the request to BEA, then the request
    is made correctly from the browser to the proxy as:
    GET /space%20demo/resource.htm HTTP/1.1
    Notic the browser is correctly URL encoding the request.
    BUT, the apache-BEA proxy plugin is incorrectly proxying the request to the BEA
    box:
    GET /space demo/resource.htm
    Notice the Apache-BEA proxy is not URL encoding the request, so when BEA gets
    it he thinks this is a request for "/space" and "demo/resource.htm" is the http
    version.
    This problem DOES NOT happen if I use the generic http proxy module provided with
    Apache.
    Has anyone seen this problem before?
    Please get back to me if you have some information.
    Thanks,
    Cole Crawford
    Paymentech

    the following is on HP Apache-based Web Server/1.3.26
    with the mod_wl.so from 6.1 sp3 proxying to a 6.1 sp3 backend and I tried setting
    up QueryFromRequest ON to no avail.
    I am having the following problem with the BEA proxy plugin for Apache. I have
    a very simply scenario to demonstrate it. Lets say that you have the following
    directory/file structure:
    /applications
         /DefaultWebApp
              spaceLink.htm
              /space demo
                   resource.htm     
    NOTE: There is a "space" in the "space demo" directory name.
    Now, spaceLink.htm has a link to the file resource.htm in the "space demo" directory.
    Here is the html:
    <html> <body> click here </body> </html>
    Now assume that apache is sitting in front of this BEA box and proxying requests
    to the BEA box.
    If the Apache-BEA proxy plugin is proxying the request to BEA, then the request
    is made correctly from the browser to the proxy as:
    GET /space%20demo/resource.htm HTTP/1.1
    Notic the browser is correctly URL encoding the request.
    BUT, the apache-BEA proxy plugin is incorrectly proxying the request to the BEA
    box:
    GET /space demo/resource.htm
    Notice the Apache-BEA proxy is not URL encoding the request, so when BEA gets
    it he thinks this is a request for "/space" and "demo/resource.htm" is the http
    version.
    This problem DOES NOT happen if I use the generic http proxy module provided with
    Apache.
    Has anyone seen this problem before?
    Please get back to me if you have some information.
    Thanks,
    Cole Crawford
    Paymentech

  • Problem in URL Encoding  in J2ME

    Hi,
    I have a problem in URL Encoding in J2ME. As i read thru the J2ME APIs, i found that J2ME doesn't support it.
    Or can i use the URL Encoding in J2SE to modify and put into J2ME?
    Or someone out there have done such coding?
    Reply me!
    Thanks!...

    like this:
    public static String URLEncoder(String str) {
    if (str == null) return null;
    StringBuffer resultStr = new StringBuffer( str.length() );
    char tmpChar;
    for( int ix=0; ix<str.length(); ix++ ) {
    tmpChar = str.charAt( ix );
    switch( tmpChar ) {
    case ' ' : resultStr.append( "%20" );
    break;
    case '-' : resultStr.append( "%2D" );
    break;
    case '/' : resultStr.append( "%2F" );
    break;
    case ':' : resultStr.append( "%3A" );
    break;
    case '=' : resultStr.append( "%3D" );
    // System.out.println( "tmpChar = '=' " + "add %3D " );
    break;
    case '?' : resultStr.append( "%3F" );
    // System.out.println( "tmpChar = '?' " + "add %3F " );
    break;
    case '#' : resultStr.append( "%23" );
    break;
    case '\r' : resultStr.append( "%0D" );
    break;
    case '\n' : resultStr.append( "%0A" );
    break;
    default : resultStr.append( tmpChar );
    break;
    return resultStr.toString();
    }

Maybe you are looking for

  • How do I add pages to a PDF in the iPad version of Acrobat reader

    How do I add pages to a PDF in the iPad version of Acrobat reader

  • "Adjust" button on iMovie 10.0.7

    When using iMovie 10.0.7, I do not have the "Adjust" button for doing picture-in-picture.  How can I turn that feature on?

  • Problem in no range after lsmw done

    Hi experts, After i have loaded my customer master datas(xd01) thru lsmw,im facing a problem in the current number ranges issue...i've uploaded of 1000 records of no range started from 10000 to 11000...but in XDN1(tcode)...it shows the current number

  • Consistent reads

    Hello I'm trying to understand what a consistent get is and the only definition I can find is: Consistent gets is a statistic showing the number of buffers that are obtained in consistent read (CR) mode I understand the db block gets statistic to be

  • Sales return delivery process wtih Excise

    Dear experts, This is chandra. Plz explain the process of Sales delivery return process with excise part how to reverse, that means where the excise details reverse in delivery or billing level after billing what is process. which register it will up