Well, after some thoughts, I can answer myself.

I tried this example:

  sFilename = "/home/username/Meine Bilder/öffentliche Fotos übertragen/015 das 
Schönste.jpg"
  i = 1
  WHILE i < Len(sFilename)
    sChar = Mid$(sFilename, i, 1)
    IF Asc(sChar) > 122 THEN
      sFilename = Left$(sFilename, i - 1) & "%" & Hex$(Asc(sChar)) & 
Right$(sFilename, Len(sFilename) - i)
    ELSE IF sChar = " " THEN
      sFilename = Replace$(sFilename, " ", "%20")
    ENDIF
    i = i + 1
  WEND
  sOut = "file://" & sFilename
  PRINT sOut

and it seems to work ok and reasonably fast.
But if you have better ideas, you're welcome!



Matti schrieb:
> Hi,
> 
> I'm looking for a string conversion function for URIs.
> It should work like CGI.Encode, but
> - don't transform slashes "/"
> - transform spaces " " not to "+" but to "%20".
> 
> Couldn't find anything in Gambas. Maybe a shell command?
> 
> Thanks
> Matti

------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day 
trial. Simplify your report design, integration and deployment - and focus on 
what you do best, core application coding. Discover what's new with
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
_______________________________________________
Gambas-user mailing list
Gambas-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/gambas-user

Reply via email to