0

when sending a request I have an error

400 Bad request: Your browser sent an invalid request.

The error is due to the encoding of Russian characters, since the command line does not process Russian characters.

/search/physical?token=Rxb7tDa5bPwZ&region=0&firstname=Андрей&secondname=Владимирович&lastname=Лугов&birthdate=10.05.1972

How can I solve this problem? do you need to send Russian characters to execute requests?

vasilek
  • 37
  • 1
  • 8
  • 1
    What does this have to do with *java*? Why did you tag your question with Java? (And what's the *programming* angle? - for general questions about user applications, you can go to superuser.com) – Erwin Bolwidt Jun 01 '18 at 07:28
  • @ErwinBolwidt sorry, tag added by mistake – vasilek Jun 01 '18 at 07:43

2 Answers2

0

Try to use url formatting, for example, standard java.net.URLDecoder

private String decode(String s) {
    try {
        return URLDecoder.decode(s, StandardCharsets.UTF_8.toString());
    } catch (UnsupportedEncodingException e) {
        e.printStackTrace();
        return "";
    }
}
WeGa
  • 801
  • 4
  • 10
  • 24
0

1. If you use curl from command line, you have to use:

    curl --data-urlencode

Like explained here: How to urlencode data for curl command?

jschnasse
  • 8,526
  • 6
  • 32
  • 72