OccasionalFlyer said:
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"
&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.
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".
then the file-processing system will convert file names into names that are fully ASCII strings
+
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.