2014-06-17 1 views
2

웹 서비스로 전달되는 변수를 URL 인코딩해야합니다.URL Roku에서 웹 서비스 호출에 대한 변수 인코딩

testcategory = "Action and Adventure" 
jsonRequest = CreateObject("roUrlTransfer") 
jsonRequest.SetURL("http://myurl.com/?method=getRokuCategorizedSeriesListing&category=" + testcategory) 

나는 값이 "testcategory"이이 웹 서비스 호출에 전달 될 인코딩 된 URL이 될 어떤이 필요합니다. 이 예에서는 "Action and Adventure"가 "Action % 20and % 20Adventure"가되어야합니다.

이를 수행하기위한 Brightscript 기능이 있습니까?

도움이 될 것입니다.

감사합니다.

답변

2

놓습니다 brightscript 파일

Function HttpEncode(str As String) As String 
    o = CreateObject("roUrlTransfer") 
    return o.Escape(str) 
End Function 

중 하나에서이 기능을 한 다음

jsonRequest.SetURL("http://myurl.com/?method=getRokuCategorizedSeriesListing&category=" + HttpEncode(testcategory)) 
+1

탈출로 기능 HttpEncode를 사용할 수는 정답이었다. 이미 인스턴스화 된 roUrlTransfer 객체가 있다는 것을 알았지 만 방금 사용했습니다. –

관련 문제