Quantcast
Channel: Appcelerator Developer Center Q&A Tag Feed (android)
Viewing all articles
Browse latest Browse all 7655

Handling a URL with special characters

$
0
0

Hi again, I'm trying to download a file but the url has special characters i.e square brackets. at first i used yahoo pipes to alter the link but the link itself gets redirected to another link that also has square brackets so i need a way of the being able to handle special characters

my download code is a followed

rowSendMessage.add(btn_visit_web);
    var trl = context.userInfo.link;
    btn_visit_web.addEventListener('click', function(e) {
 
        var xhr = Titanium.Network.createHTTPClient({
                    onload: function() {
 
                        // first, grab a "handle" to the file where you'll store the downloaded data
                        var f = Ti.Filesystem.getFile(Ti.Filesystem.applicationDataDirectory);
                        f.write(this.responseData); // write to the file
                        Ti.App.fireEvent('graphic_downloaded', {filepath:f.nativePath});
                    },
 
                });
                xhr.open('GET', trl);
                xhr.send();

Viewing all articles
Browse latest Browse all 7655

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>