0

Is it possible that the character encoding of the Android webview is wrong? I have a webview in which I should open a blob (PDF). I have attached a setDownloadListener on the webview and inside there is a onDownloadStart which passes in the url it gets from the webview.

The url it passes is: blob:https%3A//www. ....

I have a javascriptinterface for handling blobs, but now it throws 404.

I replace the incorrect "https%3A" part with "https:" before passing it to the Javascriptinterface, but I'm guessing that since the original correct url is not called in the webview there is no cookie created and therefore I get 404.

Can this be true? :) Does anyone had similar experience?

Daniel V
  • 57
  • 7

1 Answers1

0

Try this function

private String convertIntoUth8Format(String url) {
String newStr = "";
        try {
            newStr = URLDecoder.decode(url, "UTF-8");
        } catch (UnsupportedEncodingException e) {
            e.printStackTrace();
        }
        return newStr;
    }
AbhayBohra
  • 2,047
  • 24
  • 36
  • Thanks, but I think it will be too late to convert it after I get the url. The wrong one already gets called in the webview. – Daniel V May 18 '18 at 08:06
  • hey @AbhayBohra can you help me with this https://stackoverflow.com/questions/49952965/recyclerview-horizontal-scrolling-to-left?rq=1 –  May 18 '18 at 08:30