not java specific, but when I say OutputStream os = sock.getOutputStream();
is there a way to determine stream's encoding charset? or do I have to know encoding charset ahead of time to properly read it? This is for arbitrary socket connection.
views:
44answers:
2
A:
Streams do not have associated charsets. They just pass around arbitrary data. You have to know the data's charset ahead of time in order to interpret the data.
Remy Lebeau - TeamB
2010-04-20 06:31:31
A:
There is ways to detect text encoding, for example web browsers do that.
This is an implementation in Python(Universal Encoding Detector) that might give you some help.
Edit:
Here is one for java: http://jchardet.sourceforge.net/
Edit2:
Here is another SO question: http://stackoverflow.com/questions/90838
Jens Granlund
2010-04-20 10:39:50