Jump to content

Autoit Use & HTTP Request


Recommended Posts

Hi all,

I am using AutoIt Script to upload files on DropBox ..

    $oHTTP.SetRequestHeader("Dropbox-API-Arg", '{"path":"/' $sFilename & $sExtension  &  '","mode": "add"}')

It works well.

But when the $sFilename is non-English, then it fails to upload..

I think I have to encode it somehow.. I have no clue..

 

Will appreciate your help

 

Link to comment
Share on other sites

6 hours ago, Bariqah said:

Hi all,

I am using AutoIt Script to upload files on DropBox ..

    $oHTTP.SetRequestHeader("Dropbox-API-Arg", '{"path":"/' $sFilename & $sExtension  &  '","mode": "add"}')

It works well.

But when the $sFilename is non-English, then it fails to upload..

I think I have to encode it somehow.. I have no clue..

 

Will appreciate your help

 

Solved it!

Func EncodeString($s)
    $result = ''
    For $i = 1 To StringLen($s)
        $char = StringMid($s, $i, 1)
        If StringIsASCII($char) Then
            $result &= $char
        Else
            $result &= '\u' & Hex(AscW($char), 4)
        EndIf
    Next
    Return $result
EndFunc

 

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...