Antville Project

New function

Hallo everybody.

I've writen a function (for personal use of course) to replace invalid chars with nothing and "spaces" with "underscores".

I've added this to the global object.functions.js. I had Problems with different Browsers (on Linux :) when downloading files or images.

Its simply a copy of the regexp found in buildAliasFromFile plus the replacement of "spaces" with "underscores".

Look at the code: /**

  • function replaces "invalid" webchars
  • @param name String the name to convert
  • @return String determined name "invalid" char free */

function replaceinvalidchars(name) { // replace spaces with _ var spaces = new RegExp(" "); spaces.ignoreCase = true; spaces.global = true; name = name.replace(spaces,"_"); // clean name from any invalid characters var invalidChars = new RegExp("[ \/?&=\+#äöüß\\]"); invalidChars.ignoreCase = true; invalidChars.global = true; return name.replace(invalidChars,""); }

Second I added

param.alias = replaceinvalidchars(param.alias) ;

to the image and file object.functions.js. In the global object.functions.js i replaced the regexp with

line 459: // clean name from any invalid characters return replaceinvalidchars(name);

It's very simple maybe somebody adds it to the antville code if needed. Maybe nobody needs it.

Philipp

comment    

 
tobi, July 18, 2003 at 9:29:54 AM CEST

thanks

interesting to know that there are still troubles with some characters with some browsers with some systems.

link  


... comment


The Antville Server Fund has been a great success. Thanks to everybody who contributed!
online for 7830 Days
last updated: 1/4/11, 10:22 AM
status
Youre not logged in ... Login
menu
December 2022
SunMonTueWedThuFriSat
123
45678910
11121314151617
18192021222324
25262728293031
July
recent
zfuture's house here is zfuture's
house
by zfuture (7/31/03, 2:59 AM)
i understand your concerns however,
i hardly can think of a solution. certainly, if the...
by tobi (7/29/03, 9:47 AM)
Found several more similar sites
listed This is getting to be quite a concern to...
by cobalt123 (7/27/03, 7:56 PM)
Second Post Alert on Referrer
bug livecatz I put this into "help" and now here:...
by cobalt123 (7/26/03, 7:14 PM)
well it's not easy to
find from here, anyway. think we should include a link,...
by tobi (7/24/03, 11:25 AM)
So finally I found
the helma Bugzilla - stupid me.
by mdornseif (7/24/03, 10:28 AM)
clock not that it's particularly
earthshattering but the antclock is running slow by about 15...
by kohlehydrat (7/23/03, 8:25 PM)
but blogosphere.us isn't can't really
be rated as spam can it?
by kohlehydrat (7/23/03, 8:08 PM)
More referrer spam www.webfrost.com
by Irene (7/23/03, 7:55 PM)
How to log skin names
I accessed to console?? Hi, I would like to know...
by winson (7/23/03, 4:12 PM)

Click here to get an XML version of this weblog.

Made with Antville
powered by
Helma Object Publisher