I am parsing the input stream from Facebook. I use something like
BufferedReader in =
new BufferedReader(new InputStreamReader(url.openStream(), "UTF-8"));
And then in.readLinefor the actual reading from the stream.
The stream seems to have Unicode characters already encoded in ASCII, so I see things like \ u00e4 (with \ u actually being two discrete ASCII characters). Right now, I'm catching "\ u" and decoding the next two hex bytes, turning them into a char and replacing them with a string, which is obviously the worst way to do this.
I'm sure there is a cool way to use your own function to decode special characters as you read the stream (I was hoping this could be done at the InputStreamReader level). But how?
source
share