0

Now please read carefully since after searching much of StackOverflow it seems that my specific question has not been answered, however similar the other topic title is.

I have a string in java that is exactly as follows:

/Music/Robby%20Hunter%20Band%20-%20Coraz%C3%B3n.mp3

Now as I understand, since the object is a String it is encoded as UTF-16. I need the String to read

/Music/Robby Hunter Band - Corazón.mp3

I've tried converting the string to an ASCII byte array and then back into a string, but that did nothing. My guess was the byte stream was treating %20 as 3 separate characters instead of the ASCII space character.

How can I have java read a String with ASCII characters like above and understand to convert them to their proper form?

ErikAGriffin
  • 739
  • 3
  • 10
  • 21
  • 1
    Things like `%20` are not UTF-16 encodings. I believe the correct term is "URL encoding". Perhaps searching for this will give you the result you're looking for. – ajb May 14 '14 at 20:27
  • Where is Java reading that string from, a byte stream? Then how are you reading from that byte stream? Please post your method of reading the string from the byte stream. – Wes May 14 '14 at 20:28
  • 1
    You need [better search terms](http://stackoverflow.com/search?q=[java]+url+decode) – kdgregory May 14 '14 at 20:28
  • 1
    That other question has a perfect answer. – tbodt May 14 '14 at 20:31
  • Ahhh thank you @kdgregory you are absolutely right. Problem solved – ErikAGriffin May 14 '14 at 20:45

0 Answers0