AW: [opencms-dev] Spaces in filenames?
Valentin Richter
Valentin.Richter at raytion.com
Sun Aug 11 18:09:20 CEST 2002
Actually, you can use spaces and other characters in an URL but you have to URL-encode them. This way you can use the whole ISO-8859-1 (ISO-Latin) character set for URLs. With this encoding a space has to be replaced with %20 so
enterprise architecture introduction.pdf
becomes
enterprise%20architecture%20introduction.pdf
For more details see
http://www.blooberry.com/indexdot/html/topics/urlencoding.htm
To take care of encoding and decoding you have the Java classes
java.net.URLEncoder
java.net.URLDecoder
which provide appropriate methods.
In other words, when presenting files which have been uploaded to a user, OpenCMS simply has to take the original filename and and generate the corresponding URL for the href tag using URLEncoder. This is a quick and dirty solution. A clean solution to this would take care of differences between platforms (Windows and Macintosh don't distinguish between upper and lower case, Unix does et cetera), and give uploaded file a cleaned-up name which is suitable across platforms.
If someone needs to know more about what is allowed and what not on different platforms I can provide the necessary details.
Valentin Richter
Raytion GmbH
Kaiser-Friedrich-Ring 74
40547 Düsseldorf
Fon +49-211-550266-0
Fax +49-211-550266-19
http://www.raytion.com
At 14:20 Uhr +0200 11.08.2002, Alexander Kandzior wrote:
>Hi Mark,
>
>In OpenCms a filename of an uploaded file usually becomes part of the
>files URL/URI. To the best of my knowledge, a URL/URI can not have
>spaces. So I would'nt say that this is an issue with OpenCms. Some easy
>workaround could be to automatically replace all spaces with underscores
>(or some other char) at upload time, so you would not have to rename
>them manually.
>
>Best Regads,
>Alex.
>
>Alexander Kandzior
>OpenCms Group / Alkacon Software
>
>
>> -----Ursprüngliche Nachricht-----
>> Von: owner-opencms-dev at www.opencms.org
>> [mailto:owner-opencms-dev at www.opencms.org] Im Auftrag von
>> mfoley5 at csc.com.au
>> Gesendet: Dienstag, 6. August 2002 07:10
>> An: opencms-dev at opencms.org
>> Betreff: [opencms-dev] Spaces in filenames?
>>
>>
>> Hi All,
>>
>> A client has a lot of files they want to upload into their
>> OpenCms powered site, but unfortunately there are spaces in
>> most of the filenames (e.g. "enterprise architecture
>> introduction.pdf" or "pay scales for corporate
>> slaves.doc") and OpenCms is complaining.
>>
>> Is there are wish to support this (unfortunately) now common
>> practise of including spaces in filenames? A competing
>> application, Documentum, does support this...
>>
>> If anybody is doing this, or planning to, I'd like to hear, thanks.
>>
>> Regards,
>>
>> Mark Foley
>> __________________________________________________
>> CSC
>> 212 Northbourne Ave, Braddon, ACT 2612
>> Ph: +61-2-62468487 Email: mfoley5 at csc.com.au
>> --------------------------------------------------------------
>> --------------------------
>>
>> This email, including any attachments, is intended only for use by the
>> addressee(s) and may contain confidential and/or personal
>> information and may also be the subject of legal privilege.
>> Any personal information contained in this email is not to be
>> used or disclosed for any purpose other than the purpose for
>> which you have received it. If you are not the intended
>> recipient, you must not disclose or use the information
>> contained in it. In this case, please let me know by return
>> email, delete the message permanently from your system and
>> destroy any copies.
>> --------------------------------------------------------------
>> --------------------------
>>
More information about the opencms-dev
mailing list