开发者

Manipulation of URLEncoded String

开发者 https://www.devze.com 2023-01-04 22:53 出处:网络
I have to pass a string (input) in GET parameter of a URL, but there is a limit on maximum length of URL being 357.

I have to pass a string (input) in GET parameter of a URL, but there is a limit on maximum length of URL being 357.

The string is to be encoded using "Shift-JIS". For a keyword "blah 123 blahblah 321", i need to strip off last word(s) such that the string would be meaningful and the resulting URL length should be within the limit of 357.

But after converting into Shift-JIS encoding, I can no longer split string meaningfully. Converting back-n-forth would be suboptimal.

Can someone he开发者_StackOverflow社区lp here please. Thanks Nayn


My bad. This was easy.

I stripped off the encoded string on encoded delimiter. ex. For stripping off on " ", I stripped the string on URLEncoder.encode(" ", "Shift-JIS") Thanks Nayn

0

精彩评论

暂无评论...
验证码 换一张
取 消