Hello Stephan, Alle 09:34, venerdì 22 luglio 2005, Stephan Bergmann ha scritto: [...] > > I must admit that I don't understand this part of your explanation > > I'm sure that I'm missing something, may you detail a bit more this part? > > The syntax for vnd.sun.star.expand URLs is > > "vnd.sun.star.expand:" + <escaped macrofied URL> > > So if the macrofied URL is > > "$ORIGIN/foo%20bar" > > its escaped representation is > > "$ORIGIN/foo%2520bar" > > (because "%" is a character that must be escaped as "%25" when inserted > into a URL). If you do not de-escape this before de-macrofication, the > result will be some URL like > > "file:///the/origin/foo%2520bar" > > which would correspond to a filepath > > "/the/origin/foo%20bar" > > instead of the intended > > "/the/origin/foo bar"
Thank you very much for the clearful explanation! > IIRC, there currently is no functionality available from OOo Basic to do > the de-escaping. There is C++ functionality for that in rtl/uri.hxx, > and on CWS sb36 (targeted for OOo 3.0) I just added the UNO > com.sun.star.uri.UriSchemeParser_vndDOTsunDOTstarDOTexpand that includes > functionality to do the complete de-escape--and--de-macrofy step. Speaking of OOBasic, it's true, there is no a direct way to de-escape URLs, but In this specific context (macrofied url's) this workaround seems working quite well: sEscapedTwiceUrl = "$ORIGIN/foo%2520bar" sEscapedSimpleUrl = convertFromUrl(sEscapedTwiceUrl) print sEscapedSimpleUrl What do you think about? As a further possibility, I'm looking in the sources of cUrl library. http://curl.haxx.se/ The file lib/escape.c contains two functions that encodes/decodes Url's. It shouldn't be very complicated to "translate" them in OOBasic, therefore, if the first workaround wouldn't be accettable for any reasons, I could try this second way ciao Paolo --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
