I'm using
URLDecoder.decode(data,"UTF-8")
to decode my string, e.g. 100%20Natural => 100 Natural
Now the fun part, data can be already encoded, or decoded. So if I have something likes "100% Natural", it will result in Exception.
At the moment I'm laying on Exception to get the correct value, so in case exception happened, I returned the original value.
How I can handle this situation better without laying on the exception to detect if my data needs to be decoded or not? Since throwing exception is also expensive.
Thank you.