4 Replies ・ Started by mairyu at 2017-11-05 20:36:08 UTC ・ Last reply by mairyu at 2017-11-09 03:18:18 UTC

API request fails when I use Kanji for keyword, but works for Romaji

Starting 2-3 weeks ago, my search results for Kanjis came up empty on my Android App (which uses your API), I finally ran the debugger and see that the 'getInputStream' on the httpURLConnection triggers an exception.
I just saw that you moved to https, but don't think that's the issue since the Romaji based one works just fine.
Will convert to https anyway, but maybe you or someone in the forum already know what's wrong :-)

Kimtaro Admin at 2017-11-05 23:00:42 UTC

The HTTPS support was turned on just today, so that is unlikely to be the culprit, and as you say the romaji works.

I haven’t made any changes to the api in a while, but it sounds like it could possibly be an encoding issue.

Can you post the exact url your app is requesting?

mairyu at 2017-11-07 17:05:22 UTC
                dictHTTPClient.setBASE_URL("http://jisho.org/api/v1/search/words?keyword=" + KeyWord);

before I dug deeper, just wanted to check if anything major changed 2-3 weeks ago.

Kimtaro Admin at 2017-11-07 20:06:45 UTC

@mairyu Thanks. Are you doing any encoding of the KeyWord variable before this line? Are you able to log the exact URL that is being sent by the dictHTTPClient library?

mairyu at 2017-11-09 03:18:18 UTC

hmm, I just ran in the emulator and it ran fine i.e. it fetched results with the kanji as search pattern. When I run on the phone, it fails.

it shows this in the Debug window for the URL


which gives me a nice JSON in the browser. I see the same for the phone debug, but get no data in return when I:

        String data = (dictHTTPClient.getHTTPData());

This all worked just fine 2 weeks ago or so, so I don't think I have to go into UTF decoding etc. I just concatenate the String to the URL and it works.
Now that I have the Emulator working, I can dig a bit deeper, no worries.

to reply.