Displaying a "+" sign

Discussion in 'HTML' started by OccasionalFlyer, Mar 13, 2014.

  1. I'm baffled. I have a program (written in PeopleCode, similar to BASIC) that is creating URLs. There are two functions. The first one writes a URL with no repetition in it. At a few places in the code, I have it insert "+" into a string (technically I'm concatenating string1 | "+" | string2, This produces a URL with a plus sign, +, in the middle, and at least on Firefox and IE 9, it works fine.
    I get this at the end of the URL, as I am supposed to do. "&getbooks=display+books"

    When I do the same in a much longer URL that has mostly repeated content, and virtually identical code, when I add this to my URL,
    "&getbooks=display+books" I get "&getbooks=display books".
    When I code this,
    "&getbooks=display+books", I get "&getbooks=display books".

    I don't know why the two lines don't produce the same thing, but no matter.What I need is a way to force a plus sign, +, to show up when the URL is generated, and I can then paste it into a web page. What do I have to do to get what I need? I tried a decode/encode tool, and it decoded it showingthe blanks. So I don't know what to do if the special character code won't work. Any suggestions? Thanks.

    Ken
     
    OccasionalFlyer, Mar 13, 2014
    #1
    1. Advertisements

  2. Something that works in some computer languages, so you might try it:

    In order to insert a special character, use TWO of them instead of just one.. In other words, try ++ instead of +.
     
    robertmilesxyz, Mar 13, 2014
    #2
    1. Advertisements

  3. OccasionalFlyer

    richard Guest

    www.libertybasic.com

    This version of BASIC will do exactly what you want without any problems.
    I would say that your problem is in how the peoplecode code handles the
    operator.
    Liberty BASIC simply ignores any character's special properties.
    so my output would show "display+books" as intended.

    Then again, it could be a browser thing.
     
    richard, Mar 13, 2014
    #3
  4. OccasionalFlyer

    Hot-Text Guest

     
    Hot-Text, Mar 13, 2014
    #4
  5. According to the Internet standard on URLs, the plus sign "+" is a
    reserved character. This means:

    URI producing applications should percent-encode data octets that
    correspond to characters in the reserved set unless these characters
    are specifically allowed by the URI scheme to represent data in that
    component. If a reserved character is found in a URI component and
    no delimiting role is known for that character, then it must be
    interpreted as representing the data octet corresponding to that
    character's encoding in US-ASCII.

    Ref.: http://tools.ietf.org/html/rfc3986

    The percent-encoded form of "+" (U+002B) is "%2B".
    You need to describe in more detail what you are doing. Which software
    interprets the URLs in which context?

    When processing form data from a GET method submission, a "+" in the
    query part is normally interpreted as application/x-www-form-urlencoded,
    which means that "+" stands for a space.
     
    Jukka K. Korpela, Mar 13, 2014
    #5
  6. OccasionalFlyer

    Hot-Text Guest


    &getbooks=display+books"
    , "+", "_");
    &getbooks=display_books"




    A Web Browsers URL written in People_Code
    Dam I need to make a Cup of Java on that one

    Info:
    <
    http://docs.oracle.com/cd/E26239_01...htm#gb7145f3a18c29580_ef90c_1291962450f__7dac >

    Converting File Names for Files Uploaded by PutAttachment

    Generally, a PeopleCode program that calls PutAttachment will also need to save (for later use) the name of each uploaded file as it
    ended up actually being named at the specified storage location. However, the destination file name (which may have been converted
    as described in "File Name Considerations") is not passed back to the PutAttachment function.
    So,
    the only way for your PeopleCode program to ensure
    that it is saving the correct name
    is to

    either avoid using special characters in the destination file name or to simulate the conversion process in something like the
    following example:

    &ATTACHUSERFILE = Substitute(&ATTACHUSERFILE, " ", "_");
    &ATTACHUSERFILE = Substitute(&ATTACHUSERFILE, ";", "_");
    &ATTACHUSERFILE = Substitute(&ATTACHUSERFILE, "+", "_");
    &ATTACHUSERFILE = Substitute(&ATTACHUSERFILE, "%", "_");
    &ATTACHUSERFILE = Substitute(&ATTACHUSERFILE, "&", "_");
    &ATTACHUSERFILE = Substitute(&ATTACHUSERFILE, "'", "_");
    &ATTACHUSERFILE = Substitute(&ATTACHUSERFILE, "!", "_");
    &ATTACHUSERFILE = Substitute(&ATTACHUSERFILE, "@", "_");
    &ATTACHUSERFILE = Substitute(&ATTACHUSERFILE, "#", "_");
    &ATTACHUSERFILE = Substitute(&ATTACHUSERFILE, "$", "_");

    Note. Unlike the PutAttachment function,
    the AddAttachment function automatically returns

    the converted file name for reference and later use.

    For example,
    the file name My Resume.doc
    is returned through the AddAttachment function as
    My_Resume.doc,
    with the space converted to an
    Underscore.
    then the file-processing system will convert file names into names that are fully ASCII strings

    &#43

    Browsers written %26%2343
    not The +

    Browsers see it as %26%2343

    %26 = &
    %23 = #
    43 = 43

    That your Error

    Attachments with non-ASCII File Names

    To successfully upload an attachment from a locale with a file
    name in a language that uses a non-ASCII characters,
    such as Japanese,
    Oracle recommends running your application server in an
    environment that supports non-ASCII character languages.

    If the storage location for the attachment is an FTP site or an HTTP repository,
    Oracle recommends that the storage location also be running in an environment that
    supports the same language or locale as the file names used.

    The web server (which serves as an intermediary in the transfer of
    the file from the browser to the application server and then on to
    the storage location) can be running on either an English environment
    or a non-ASCII character language environment.

    If your environment does not fully support non-ASCII characters,
    then the file-processing system will convert file names into names
    that are fully ASCII strings.

    At upload time,
    the new file names will be passed back to
    the calling PeopleCode program rather than
    the original names of the files
    as selected by the end users.

    This means that it may be more difficult
    for an end user to later identify the renamed file
    for further processing,
    such as selecting and viewing the file.
     
    Hot-Text, Mar 13, 2014
    #6
    1. Advertisements

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.