Android Question Encode file to send to javascript (in a Webview)

stevel05

Expert
Licensed User
Longtime User
What is the best way to send a file to javascript (in a webview)?

As the attached project shows, using URI encode from android.net.URI (and JavaObject) and the corresponding javascript decodeURI, leaves some characters encoded ( same with StringUtils, encodeURL).

It works if I use org.apache.commons.lang.StringEscapeUtils escapeEcmaScript method downloadable from: http://commons.apache.org/proper/commons-lang/download_lang.cgi (and JavaObject), but the lib is 400+k in size and the JS decode method is deprecated. I can also get it to work encoding with StringUtils in Base64 and using a js lib Base64 decoding lib from here:
http://jsbase64.codeplex.com/releases/view/89265, that lib is just 6k.

Has anyone found a way using the encoding currently available to encode a file? or is this something new I am trying?
 

Attachments

  • URIEncode.zip
    13.9 KB · Views: 201
Top