Hello,
on a german Windows, when searching with the bingmapsprovider for "München",
the tooltip on the Pin doesn't shows the ü in the correct way.
Hello, Rolf,
I have tested locally RadMap with German culture set to the System.Threading.Thread.CurrentThread.CurrentCulture property. When I type "munich" in the search textbox and hit Enter, the tooltip for the added pins looks as it is demonstrated below:
I suppose that you are using the BingRestMapProvider and I would like to give you some details how we do the search in RadMap. We use a WebClient and pass an Uri for each request:
public void SearchAsync(SearchRequest request)
{
Uri uri = this.BuildSearchRequestUri(request);
try
{
WebClient client = new WebClient();
client.DownloadStringCompleted += this.OnSearchRequestCompleted;
client.DownloadStringAsync(uri, request.UserData);
}
catch (Exception ex)
{
throw new Exception(string.Format("Search Service Exception: {0}", ex.Message), ex);
}
}
This is the constructed Uri for the "munich" search:
Once the WebClient.DownloadStringCompleted event is fired we manage the result in the following way:
protected virtual void OnSearchRequestCompleted(object sender, DownloadStringCompletedEventArgs e)
{
WebClient client = sender as WebClient;
client.DownloadStringCompleted -= this.OnSearchRequestCompleted;
if (e.Error == null)
{
try
{
Response response;
#if NET2
response = JsonConvert.DeserializeObject<Response>(e.Result, new JsonResourceConvrter());
#else
using (MemoryStream stream = new MemoryStream(Encoding.UTF8.GetBytes(e.Result)))
{
DataContractJsonSerializer serializer = new DataContractJsonSerializer(typeof(Response));
response = serializer.ReadObject(stream) as Response;
}
#endif
if (response != null && response.ResourceSets != null && response.ResourceSets.Length > 0 && response.ResourceSets[0].Resources != null && response.ResourceSets[0].Resources.Length > 0)
{
Location[] locations = new Location[response.ResourceSets[0].Resources.Length];
for (int i = 0; i < locations.Length; i++)
{
locations[i] = response.ResourceSets[0].Resources[i] as Location;
}
this.OnSearchCompleted(new SearchCompletedEventArgs(locations, e.UserState));
}
else
{
this.OnSearchError(new SearchErrorEventArgs(new WebException("The remote server returned an error: (404) Not Found.")));
}
}
#if NET2
catch (JsonSerializationException) { }
#else
catch (SerializationException) { }
#endif
}
else
{
this.OnSearchError(new SearchErrorEventArgs(e.Error));
}
}
After some research in general programming forums, I have found the following thread which explains that the UTF8 encoding is not enough and ISO-8859-1 is also important for the German language:
https://stackoverflow.com/questions/1922199/c-sharp-convert-string-from-utf-8-to-iso-8859-1-latin1-h
That is why I have logged it in our feedback portal by creating a public thread on your behalf. You can track its progress, subscribe for status changes and add your comments on the following link - feedback item.
I have also updated your Telerik points.
Currently, the possible solution that I can suggest is to use the following custom implementation of the BingRestMapProvider:
public class CustomBingRestMapProvider : BingRestMapProvider
{
protected override void OnSearchRequestCompleted(object sender, DownloadStringCompletedEventArgs e)
{
WebClient client = sender as WebClient;
client.DownloadStringCompleted -= this.OnSearchRequestCompleted;
if (e.Error == null)
{
try
{
Response response;
Encoding iso = Encoding.GetEncoding("ISO-8859-1");
Encoding utf8 = Encoding.UTF8;
byte[] utfBytes = utf8.GetBytes(e.Result);
byte[] isoBytes = Encoding.Convert(utf8, iso, utfBytes);
using (MemoryStream stream = new MemoryStream(isoBytes))
{
DataContractJsonSerializer serializer = new DataContractJsonSerializer(typeof(Response));
response = serializer.ReadObject(stream) as Response;
}
if (response != null && response.ResourceSets != null && response.ResourceSets.Length > 0 && response.ResourceSets[0].Resources != null && response.ResourceSets[0].Resources.Length > 0)
{
Location[] locations = new Location[response.ResourceSets[0].Resources.Length];
for (int i = 0; i < locations.Length; i++)
{
locations[i] = response.ResourceSets[0].Resources[i] as Location;
}
this.OnSearchCompleted(new SearchCompletedEventArgs(locations, e.UserState));
}
else
{
this.OnSearchError(new SearchErrorEventArgs(new WebException("The remote server returned an error: (404) Not Found.")));
}
}
catch (SerializationException) { }
}
else
{
this.OnSearchError(new SearchErrorEventArgs(e.Error));
}
}
}
I hope this information helps. If you need any further assistance please don't hesitate to contact me.
Regards,
Dess | Tech Support Engineer, Sr.
Progress Telerik
Love the Telerik and Kendo UI products and believe more people should try them? Invite a fellow developer to become a Progress customer and each of you can get a $50 Amazon gift voucher.