sorry, the code for conversion is the following way:
because it seems the source XML seems encoded in MS932. when I do not specify encoding in new InputStreamReader() and I get the encoding is :MS932, by calling InputStreamReader.InputStreamReader(). Add code tags. CR[/edit] [ July 19, 2008: Message edited by: Campbell Ritchie ]
If this is a valid XML source, the encoding is mentioned in the header. If you'd simply use an XML parser (I like Dom4J), you wouldn't need to worry about the encoding at all, because it would take care of it automatically.
The soul is dyed the color of its thoughts. Think only on those things that are in line with your principles and can bear the light of day. The content of your character is your choice. Day by day, what you do is who you become. Your integrity is your destiny - it is the light that guides your way. - Heraclitus
Joined: Jul 19, 2008
thanks Preuss, the XML is not valid, only well-formed.
Google HAS a chinese version of that weather information, BUT, when I specify "zh-CN" in URL,I get garbage content(ASCII part is ok.) AND, the content seems still being encoded with MS932, which is a Japanese character set.
I suspect that the issue is due to my Japanese version of windows XP. So I tried to set AcceptLanuage, AceeptEncoding headers etc. of my httprequest, but I failed to get correct content again.
Anybody else can help?
the source code is not complex, can anybody give it a try?
Of course, it's better you have a Japanese XP, or else you may not see the issue. [ July 19, 2008: Message edited by: gang lee ]
but the encoding does not seem UTF-16... because the browser(firefox2) say it's UTF-8 from view->character encoding.
one discouraging issue for beginner!
with the same URL with Internet Exploer: when I see menu: view->encoding, the pop up menu says: GB2312 Unicode(UTF-8) X Unicode Other and the menu is grey, forbidding user to re-choose. [ July 19, 2008: Message edited by: gang lee ]
subject: can not read remote XML correctly, due to encoding issue