<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0">
	<channel>
		<title><![CDATA[Latest posts for the topic "I have problems using the webservice with blanks and special characters"]]></title>
		<link>http://forum.geonames.org/gforum/posts/list/6.page</link>
		<description><![CDATA[Latest messages posted in the topic "I have problems using the webservice with blanks and special characters"]]></description>
		<generator>JForum - http://www.jforum.net</generator>
			<item>
				<title>I have problems using the webservice with blanks and special characters</title>
				<description><![CDATA[ Question :
The geocoding webservice does not work with special character like ö or blanks.


Answer :
The parameters for the webservices have to be utf8 url encoded.  If you call the webservice with "New York" you have to url encode "New York", otherwise our service will search for "New" and all other parameters afterwards get lost.

"New York" becomes "New%20York" and instead of ö use %C3%B6.


URL Encoding replaces spaces with "+" signs, and unsafe ASCII characters with "%" followed by their hex equivalent. Safe characters are defined in RFC2396. They are the 7-bit ASCII alphanumerics and the mark characters "-_.!~*'()".

Check the documentation of your programming language to see how url encoding is done in your programming language.

Java example :
java.net.UrlEncoder("ö","UTF8");

Perl :
use URI::Escape;
$escapedParameter = uri_escape_utf8("new york"); 


javascript example :
encodeURIComponent("ö")

(Note that the standard JavaScript escape and unescape functions operate slightly differently: they encode space as "%20", and treat "+" as a safe character.)

Pyton :
Nicolas Laurance has written a client library for geonames :
http://www.zindep.com/blog-zindep/Geoname-python/]]></description>
				<guid isPermaLink="true">http://forum.geonames.org/gforum/posts/list/8.page#9</guid>
				<link>http://forum.geonames.org/gforum/posts/list/8.page#9</link>
				<pubDate><![CDATA[Fri, 16 Dec 2005 14:14:03]]> GMT</pubDate>
				<author><![CDATA[ marc]]></author>
			</item>
			<item>
				<title>Re:I have problems using the webservice with blanks and special characters</title>
				<description><![CDATA[ I'm using utf8_encode in php to encode strings. It works fine most of the time but I'm getting the occasional odd results like the following when searching for Ryūō Japan...

http://ws.geonames.org/search?name_equals=Ry%u016B%u014D&country=JP&fcode=ppl&fcode=pplc&fcode=ppla&style=full

<status message="missing parameter" value="12"/>]]></description>
				<guid isPermaLink="true">http://forum.geonames.org/gforum/posts/list/8.page#1972</guid>
				<link>http://forum.geonames.org/gforum/posts/list/8.page#1972</link>
				<pubDate><![CDATA[Mon, 30 Apr 2007 10:58:18]]> GMT</pubDate>
				<author><![CDATA[ zeman]]></author>
			</item>
			<item>
				<title>Re:I have problems using the webservice with blanks and special characters</title>
				<description><![CDATA[ Only utf8 encoding is not sufficient. It also needs to be url encoded. Something like this :

rawurlencode(utf8_encode($input))

The result should look like this :
http://dev.geonames.org/search?name_equals=Ry%C5%AB%C5%8D

Regards

Marc]]></description>
				<guid isPermaLink="true">http://forum.geonames.org/gforum/posts/list/8.page#1975</guid>
				<link>http://forum.geonames.org/gforum/posts/list/8.page#1975</link>
				<pubDate><![CDATA[Mon, 30 Apr 2007 16:25:35]]> GMT</pubDate>
				<author><![CDATA[ marc]]></author>
			</item>
			<item>
				<title>I have problems using the webservice with blanks and special characters</title>
				<description><![CDATA[ Hallo

<p></p>

		<cite>marc wrote:</cite><br>
		<blockquote>
Perl :
use URI::Escape;
$escapedParameter = uri_escape("new york"); 
&nbsp;
		</blockquote>

Point your browser to <a href="http://search.cpan.org/~gaas/URI-1.35/URI/Escape.pm" target="_new" rel="nofollow">CPAN</a>
uri_escape_utf8() is available for UTF-8 url encoding in newer versions of URI::Escape.
It's needed (and nice to use) if the Page where the user typed in the search query uses ISO-8859-1.

Regards
 Kristian

EDIT: <a href="http://search.cpan.org/~perhenrik/Geo-GeoNames-0.03/lib/Geo/GeoNames.pm" target="_new" rel="nofollow">See also</a>

please excuse my bad english...]]></description>
				<guid isPermaLink="true">http://forum.geonames.org/gforum/posts/list/8.page#2167</guid>
				<link>http://forum.geonames.org/gforum/posts/list/8.page#2167</link>
				<pubDate><![CDATA[Wed, 30 May 2007 19:38:18]]> GMT</pubDate>
				<author><![CDATA[ Kristian]]></author>
			</item>
			<item>
				<title>Re:I have problems using the webservice with blanks and special characters</title>
				<description><![CDATA[ Thanks, Kristian. I have updated the posting.]]></description>
				<guid isPermaLink="true">http://forum.geonames.org/gforum/posts/list/8.page#2168</guid>
				<link>http://forum.geonames.org/gforum/posts/list/8.page#2168</link>
				<pubDate><![CDATA[Wed, 30 May 2007 20:03:01]]> GMT</pubDate>
				<author><![CDATA[ marc]]></author>
			</item>
			<item>
				<title>Re:I have problems using the webservice with blanks and special characters</title>
				<description><![CDATA[ In Ruby:
require 'cgi'
CGI.escape('new york')]]></description>
				<guid isPermaLink="true">http://forum.geonames.org/gforum/posts/list/8.page#2232</guid>
				<link>http://forum.geonames.org/gforum/posts/list/8.page#2232</link>
				<pubDate><![CDATA[Sat, 9 Jun 2007 05:40:20]]> GMT</pubDate>
				<author><![CDATA[ PhilBo]]></author>
			</item>
			<item>
				<title>Re:I have problems using the webservice with blanks and special characters</title>
				<description><![CDATA[ In PHP, I am using this:

<span class="genmed"><b>Code:</b></span><br>
		<div style="overflow: auto; width: 100%;">
		<pre>$encoding = mb_detect_encoding&#40;$query&#41;;
if&#40;$encoding == 'UTF-8'&#41; {
	$query_escaped = urlencode&#40;$query&#41;;
} else {
	$query_escaped = urlencode&#40;utf8_encode&#40;$query&#41;&#41;;
}</pre>
		</div>

It's probably not the best way to go about it, but it works whether you are using UTF-8 for your php files themselves or not.]]></description>
				<guid isPermaLink="true">http://forum.geonames.org/gforum/posts/list/8.page#2324</guid>
				<link>http://forum.geonames.org/gforum/posts/list/8.page#2324</link>
				<pubDate><![CDATA[Tue, 3 Jul 2007 01:25:56]]> GMT</pubDate>
				<author><![CDATA[ eyeRmonkey]]></author>
			</item>
			<item>
				<title>Re:I have problems using the webservice with blanks and special characters</title>
				<description><![CDATA[ I came up with a better way to accomplish this without using the mbstring library:

<span class="genmed"><b>Code:</b></span><br>
		<div style="overflow: auto; width: 100%;">
		<pre>if&#40;is_unicode&#40;$query&#41;&#41; {
	$query_escaped = urlencode&#40;$query&#41;;
} else {
	$query_escaped = urlencode&#40;utf8_encode&#40;$query&#41;&#41;;
}</pre>
		</div>]]></description>
				<guid isPermaLink="true">http://forum.geonames.org/gforum/posts/list/8.page#2468</guid>
				<link>http://forum.geonames.org/gforum/posts/list/8.page#2468</link>
				<pubDate><![CDATA[Mon, 23 Jul 2007 01:25:37]]> GMT</pubDate>
				<author><![CDATA[ eyeRmonkey]]></author>
			</item>
			<item>
				<title>Re:I have problems using the webservice with blanks and special characters</title>
				<description><![CDATA[ Hi, I'm having problems with the ' character (single quote)...

The URL I'm getting is http://ws.geonames.org/search?name_equals=Bassin%20d%27Arcachon&country=FR&maxRows=30&style=FULL&lang=fr

The GeoName is Bassin d'Arcachon, I'm using php like this:

<span class="genmed"><b>Code:</b></span><br>
		<div style="overflow: auto; width: 100%;">
		<pre>$xml = simplexml_load_file&#40;"http://ws.geonames.org/search?name_equals=".rawurlencode&#40;utf8_encode&#40;stripslashes&#40;$loc&#41;&#41;&#41;."&country=$cp&maxRows=30&style=FULL&lang=fr"&#41;;</pre>
		</div>

where $loc is utf8-decoded and rawurldecoded already.

Does any of you have this problem?

This is the location: http://www.geonames.org/3037252/bassin-d-arcachon.html]]></description>
				<guid isPermaLink="true">http://forum.geonames.org/gforum/posts/list/8.page#3587</guid>
				<link>http://forum.geonames.org/gforum/posts/list/8.page#3587</link>
				<pubDate><![CDATA[Fri, 22 Feb 2008 17:39:32]]> GMT</pubDate>
				<author><![CDATA[ bruno bernardino]]></author>
			</item>
			<item>
				<title>Re:I have problems using the webservice with blanks and special characters</title>
				<description><![CDATA[ Hi Bruno

This was a problem on our side with the name_equals parameter. I have fixed it. Thanks for having reported it.

Cheers

Marc]]></description>
				<guid isPermaLink="true">http://forum.geonames.org/gforum/posts/list/8.page#3593</guid>
				<link>http://forum.geonames.org/gforum/posts/list/8.page#3593</link>
				<pubDate><![CDATA[Sun, 24 Feb 2008 11:37:38]]> GMT</pubDate>
				<author><![CDATA[ marc]]></author>
			</item>
			<item>
				<title>Re:I have problems using the webservice with blanks and special characters</title>
				<description><![CDATA[ i seem to be having a similiar issue with Goiás Brazil


http://ws.geonames.org/searchJSON?q=goi%E3%A1s%20brazil&maxRows=10&style=FULL

returns no results but

http://www.geonames.org/search.html?q=Goiás+Brazil&country=

does.]]></description>
				<guid isPermaLink="true">http://forum.geonames.org/gforum/posts/list/8.page#5947</guid>
				<link>http://forum.geonames.org/gforum/posts/list/8.page#5947</link>
				<pubDate><![CDATA[Sun, 7 Jun 2009 12:34:33]]> GMT</pubDate>
				<author><![CDATA[ jasonj]]></author>
			</item>
			<item>
				<title>Re:I have problems using the webservice with blanks and special characters</title>
				<description><![CDATA[ your encoding for the json service does not look correct.

It should be "Goi%C3%A1s" instead of "goi%E3%A1s".

Best

Marc]]></description>
				<guid isPermaLink="true">http://forum.geonames.org/gforum/posts/list/8.page#5948</guid>
				<link>http://forum.geonames.org/gforum/posts/list/8.page#5948</link>
				<pubDate><![CDATA[Sun, 7 Jun 2009 13:31:19]]> GMT</pubDate>
				<author><![CDATA[ marc]]></author>
			</item>
			<item>
				<title>Prob. for URL Encoding</title>
				<description><![CDATA[ I was also facing the same problem for url encoding, but its for VC++. I had written a separate function for the same and now its working. But is there any ready made function or procedure with Geo Names which we can directly apply for url encoding which will work for all types of windows applications?]]></description>
				<guid isPermaLink="true">http://forum.geonames.org/gforum/posts/list/8.page#6748</guid>
				<link>http://forum.geonames.org/gforum/posts/list/8.page#6748</link>
				<pubDate><![CDATA[Thu, 26 Nov 2009 12:21:31]]> GMT</pubDate>
				<author><![CDATA[ harshadashende]]></author>
			</item>
			<item>
				<title>Re:I have problems using the webservice with blanks and special characters</title>
				<description><![CDATA[ I am getting XML file as a result of "http://ws.geonames.org/search?name=&country=IN&type=xml" .
and in this file, i am getting a city as "Tiruchchirāppalli" . now i want to display this city name as it is, but when i am displaying it, it is shown as "TiruchchirÄppalli" . Is there any solution for this.?]]></description>
				<guid isPermaLink="true">http://forum.geonames.org/gforum/posts/list/8.page#6750</guid>
				<link>http://forum.geonames.org/gforum/posts/list/8.page#6750</link>
				<pubDate><![CDATA[Thu, 26 Nov 2009 13:51:40]]> GMT</pubDate>
				<author><![CDATA[ harshadashende]]></author>
			</item>
			<item>
				<title>Re:I have problems using the webservice with blanks and special characters</title>
				<description><![CDATA[ You have to use the proper encoding. UTF8 in this case.

Marc]]></description>
				<guid isPermaLink="true">http://forum.geonames.org/gforum/posts/list/8.page#6753</guid>
				<link>http://forum.geonames.org/gforum/posts/list/8.page#6753</link>
				<pubDate><![CDATA[Fri, 27 Nov 2009 06:41:43]]> GMT</pubDate>
				<author><![CDATA[ marc]]></author>
			</item>
			<item>
				<title>Re:I have problems using the webservice with blanks and special characters</title>
				<description><![CDATA[ Thank you for your reply, but i don't know how to such encoding it in VC++. ]]></description>
				<guid isPermaLink="true">http://forum.geonames.org/gforum/posts/list/8.page#6757</guid>
				<link>http://forum.geonames.org/gforum/posts/list/8.page#6757</link>
				<pubDate><![CDATA[Fri, 27 Nov 2009 07:46:22]]> GMT</pubDate>
				<author><![CDATA[ harshadashende]]></author>
			</item>
			<item>
				<title>Re:I have problems using the webservice with blanks and special characters</title>
				<description><![CDATA[ I am making a software for get geonames, in flash with visual basic or mdm zinc...

When is only the flash, the swf load well the data from geonames.org, but when put in visual basic or mdm zinc, not get the xml answer...

Why???

Here are a complete example with the source, the exe - not work -, the fla, the swf:

http://www.astrodreams.com/aaa/xmlzincsample.rar

I test for download a xml from my web site, and work, but in the exe when attempt to load the data from geonames - for example: http://ws.geonames.org/search?q=london&maxRows=20 -, not work, in the exe the flash not load the xml from geonames and I not know why...

Why?

Good day!!!]]></description>
				<guid isPermaLink="true">http://forum.geonames.org/gforum/posts/list/8.page#6886</guid>
				<link>http://forum.geonames.org/gforum/posts/list/8.page#6886</link>
				<pubDate><![CDATA[Thu, 24 Dec 2009 15:30:52]]> GMT</pubDate>
				<author><![CDATA[ Javier Reinoso]]></author>
			</item>
			<item>
				<title>Re:I have problems using the webservice with blanks and special characters</title>
				<description><![CDATA[ Hi,

I'm trying to use the wikipediaSearch webservice with the title parameter on the term 'Musée de Cluny'. I'm using URL encoding:

http://ws.geonames.org/wikipediaSearch?&maxRows=1&title=Mus%C3%A9e%20de%20Cluny&username=demo

but getting no results.

the environment is .NET - CSharp.

Wikipedia value is available:

http://en.wikipedia.org/wiki/Mus%C3%A9e_de_Cluny

What am I doing wrong?

Regards,
Elad.]]></description>
				<guid isPermaLink="true">http://forum.geonames.org/gforum/posts/list/8.page#9741</guid>
				<link>http://forum.geonames.org/gforum/posts/list/8.page#9741</link>
				<pubDate><![CDATA[Wed, 25 May 2011 10:32:46]]> GMT</pubDate>
				<author><![CDATA[ eladzaa]]></author>
			</item>
			<item>
				<title>Re:I have problems using the webservice with blanks and special characters</title>
				<description><![CDATA[ The domain name ws.geonames.org is desupported:

http://geonames.wordpress.com/2011/01/28/application-identification-for-free-geonames-web-services/

Please use the domain api.geonames.org and it will work:
http://api.geonames.org/wikipediaSearch?&maxRows=1&title=Mus%C3%A9e%20de%20Cluny&username=demo

Best

Marc]]></description>
				<guid isPermaLink="true">http://forum.geonames.org/gforum/posts/list/8.page#9763</guid>
				<link>http://forum.geonames.org/gforum/posts/list/8.page#9763</link>
				<pubDate><![CDATA[Sun, 29 May 2011 22:52:33]]> GMT</pubDate>
				<author><![CDATA[ marc]]></author>
			</item>
			<item>
				<title>Re:I have problems using the webservice with blanks and special characters</title>
				<description><![CDATA[ I am trying to cal the search Web Service to search for "Ivory Coast", using the name parameter, in Portuguese (which is "Costa do Marfim") and i am having trouble figuring out whats wrong:

Name: costa marfim
http://api.geonames.org/searchJSON?maxRows=20&username=frames&featureClass=A&featureClass=P&featureClass=L&orderby=population&<b>name=costa%20marfim</b>&lang=pt&searchlang=pt
	Result: <span class="genmed"><b>Code:</b></span><br>
		<div style="overflow: auto; width: 100%;">
		<pre>{"totalResultsCount":0,"geonames":&#91;&#93;}</pre>
		</div>
Name: costa do marfim
http://api.geonames.org/searchJSON?maxRows=20&username=frames&featureClass=A&featureClass=P&featureClass=L&orderby=population&<b>name=costa%20do%20marfim</b>&lang=pt&searchlang=pt
	Result: <span class="genmed"><b>Code:</b></span><br>
		<div style="overflow: auto; width: 100%;">
		<pre>{"totalResultsCount":0,"geonames":&#91;&#93;}</pre>
		</div>
Name: costa marfim (with "+" instead of the "%20")
http://api.geonames.org/searchJSON?maxRows=20&username=frames&featureClass=A&featureClass=P&featureClass=L&orderby=population&<b>name=costa+marfim</b>&lang=pt&searchlang=pt
	Result: <span class="genmed"><b>Code:</b></span><br>
		<div style="overflow: auto; width: 100%;">
		<pre>{"totalResultsCount":0,"geonames":&#91;&#93;}</pre>
		</div>
Name: marfim costa
http://api.geonames.org/searchJSON?maxRows=20&username=frames&featureClass=A&featureClass=P&featureClass=L&orderby=population&<b>name=marfim%20costa</b>&lang=pt&searchlang=pt
	Result: <span class="genmed"><b>Code:</b></span><br>
		<div style="overflow: auto; width: 100%;">
		<pre>{"totalResultsCount":1,"geonames":&#91;{"adminCode1":"00","lng":"-5.5","geonameId":2287781,"toponymName":"Republic of Côte d’Ivoire","countryId":"2287781","fcl":"A","population":21058798,"countryCode":"CI","name":"Costa do Marfim","fclName":"country, state, region,...","countryName":"Costa do Marfim","fcodeName":"independent political entity","adminName1":"","lat":"8","fcode":"PCLI"}&#93;}</pre>
		</div>
Name: "costa do marfim"
http://api.geonames.org/searchJSON?maxRows=20&username=frames&featureClass=A&featureClass=P&featureClass=L&orderby=population&<b>name=%22costa%20do%20marfim%22</b>&lang=pt&searchlang=pt
	Result: <span class="genmed"><b>Code:</b></span><br>
		<div style="overflow: auto; width: 100%;">
		<pre>{"totalResultsCount":1,"geonames":&#91;{"adminCode1":"00","lng":"-5.5","geonameId":2287781,"toponymName":"Republic of Côte d’Ivoire","countryId":"2287781","fcl":"A","population":21058798,"countryCode":"CI","name":"Costa do Marfim","fclName":"country, state, region,...","countryName":"Costa do Marfim","fcodeName":"independent political entity","adminName1":"","lat":"8","fcode":"PCLI"}&#93;}</pre>
		</div>

Is "%20" the correct enconding for white spaces? If so why does name=costa%20marfim return no results?
What search is done when the name is enclosed in double quotes "%22costa%20do%20marfim%22"? Does it search for a exact name?

Thank in advance for the help.]]></description>
				<guid isPermaLink="true">http://forum.geonames.org/gforum/posts/list/8.page#43809</guid>
				<link>http://forum.geonames.org/gforum/posts/list/8.page#43809</link>
				<pubDate><![CDATA[Sun, 19 Mar 2017 09:21:54]]> GMT</pubDate>
				<author><![CDATA[ nmfr]]></author>
			</item>
	</channel>
</rss>