n0On3
11th October 2004 15:08 UTC
modifying strings
I have a normal windows path string like "C:\windows\my programs" and I need it to be converted to "C:/windows/my%20programs".
At the beginning I thought I only needed to change backlashes to lashes, but now I realise special characters need to be changed aswell.
Does anybody know a good trick?
The only way I know how to proceed is a single character check to every special character, which would result in a big big code.
kichik
11th October 2004 15:27 UTC
If you don't mind having a dependency on Internet Explorer 3.0 and above, you can use InternetCanonicalizeUrl. It's an API function provided by wininet.dll.
kichik
11th October 2004 15:54 UTC
For example:
StrCpy $0 "http://nsis.sf.net/some spaces/path\with\back slashes"
System::Call "wininet::InternetCanonicalizeUrl(t r0, t .r0, \
*i ${NSIS_MAX_STRLEN}, i 0)"
DetailPrint $0
n0On3
11th October 2004 17:30 UTC
perfect, exactly what I needed :D
I hope my users don't have any problem with ie3...