<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0">
	<channel>
		<title><![CDATA[Latest posts for the topic "Encoding problem when using Java client"]]></title>
		<link>http://forum.geonames.org/gforum/posts/list/4.page</link>
		<description><![CDATA[Latest messages posted in the topic "Encoding problem when using Java client"]]></description>
		<generator>JForum - http://www.jforum.net</generator>
			<item>
				<title>Encoding problem when using Java client</title>
				<description><![CDATA[ Hi all,

I'm using the geonames Java client to find a city with the given postal code and country. I am having problems with umlauts - I'm getting ?-signs instead of the correct umlaut - K?ln instead of the correct Köln.

My code looks like:

PostalCodeSearchCriteria pcsq = new PostalCodeSearchCriteria();
pcsq.setCountryCode("DE");
pcsq.setPostalCode("50667");
List<PostalCode> foundList1 = WebService.postalCodeSearch(pcsq);
for (PostalCode postalCode : foundList1) {
	System.out.println(postalCode.getPlaceName());
}

Any ideas? 
Thank you very much in advance!

Dimi
]]></description>
				<guid isPermaLink="true">http://forum.geonames.org/gforum/posts/list/1473.page#6153</guid>
				<link>http://forum.geonames.org/gforum/posts/list/1473.page#6153</link>
				<pubDate><![CDATA[Wed, 29 Jul 2009 15:04:30]]> GMT</pubDate>
				<author><![CDATA[ Dimi]]></author>
			</item>
			<item>
				<title>Re:Encoding problem when using Java client</title>
				<description><![CDATA[ Hi Dimi

When I copy paste your code and run it then I get 'Köln' with the correct Umlaut.

Best

Marc]]></description>
				<guid isPermaLink="true">http://forum.geonames.org/gforum/posts/list/1473.page#6156</guid>
				<link>http://forum.geonames.org/gforum/posts/list/1473.page#6156</link>
				<pubDate><![CDATA[Thu, 30 Jul 2009 22:40:21]]> GMT</pubDate>
				<author><![CDATA[ marc]]></author>
			</item>
			<item>
				<title>Re:Encoding problem when using Java client</title>
				<description><![CDATA[ Hi all and thank you Marc for your reply!

So, I solved it!

The problem was the incorrect encoding of the response-object of the servlet:

.....
PostalCodeSearchCriteria pcsq = new PostalCodeSearchCriteria();
pcsq.setCountryCode("DE");
pcsq.setPostalCode("50667");

List<PostalCode> foundList = WebService.postalCodeSearch(pcsq);
.....
<font color='red'>response.setCharacterEncoding("UTF-8");</font> //this line solved the problem
//returnObject is an JSON object
response.getWriter().write(returnObject.toString());

I hope this helps someone, who tries to implement autocompletion using a servlet and the geonames Java client

Dimi
]]></description>
				<guid isPermaLink="true">http://forum.geonames.org/gforum/posts/list/1473.page#6186</guid>
				<link>http://forum.geonames.org/gforum/posts/list/1473.page#6186</link>
				<pubDate><![CDATA[Mon, 10 Aug 2009 11:25:34]]> GMT</pubDate>
				<author><![CDATA[ Dimi]]></author>
			</item>
	</channel>
</rss>