0

I'm trying to unescape this string "Selby%2C%20SD" so the result would be "Selby, SD" (I assume) but can't find the way.

I've tried

StringEscapeUtils.unescapeHtml4("Selby%2C%20SD")

but the result is the same string. I've also tried StringEscapeUtils.unescapeHtml but didn't work either. What am I doing wrong?

Thanks.

0

1 Answer 1

3

You should use URLDecoder in java.net.URLDecoder;

import java.net.URLDecoder;

public class MainClass {

    public static void main(String [] args) {
        String tempStr = "Selby%2C%20SD";
        System.out.println(URLDecoder.decode(tempStr, "UTF-8"));
    }
}

Output:

Selby, SD
Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.