How to pass a Persian string as a argument in the URL?

后端 未结 2 1776
無奈伤痛
無奈伤痛 2020-12-18 00:49

I have a URL like this pattern:

www.example.com/ClassName/MethodName/Arg1/Arg2

Also here is my .htaccess file:



        
2条回答
  •  暖寄归人
    2020-12-18 01:04

    Use URL encoder:

    String encodedURL = "www.example.com/ClassName/Methodname/254/" + URLEncoder.encode("Any text in any language", "utf-8");
    

    UTF-8 of course is the encoding to use.

    You can read more here: https://docs.oracle.com/javase/7/docs/api/java/net/URLEncoder.html

提交回复
热议问题