question

Al-9132 avatar image
0 Votes"
Al-9132 asked AryaDing-MSFT commented

Win 8.1 Bing map control displays chinese characters on application initialisation

Hi
A win8.1 app, which used the Win 8.1 Bing map control, was migrated to a UWP App. But the 8.1 BingMap control is still being used (I assume due to existing customer's licences etc).

Lately we've noticed that if the device language is not English, then first time a user navigates to the map screen, it displays what appears to be Chinese characters. The Chinese language pack has not been installed on the device.

Navigating away from this map-screen and coming back seems to display English, even when the device language is set to Spanish. Spanish language pack is present on the device.

The UWP App's PrimaryLanguageOverride is set to the current language (GlobalizationPreferences.Languages[0]) at app initialisation time.
Also this doesn’t happen when debugging the application.

occurs on
Windows 10 Enterprise - Version: 1809 - Build: 17763.973,
Windows 10 - version: 1909 - Build : 18363.1440
and others as it's been reported by users

Does not occur on
Windows 10 Build : 17763.1577


Any help or insight on this issue is appreciated


Al

dotnet-csharpwindows-uwp
· 2
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

@Al-9132 Will these situations still happen if the device language is English? Could you please provide us your code snippet?

0 Votes 0 ·

Added some more information... but accidently "as an answer". It is not an answer; just my lack of familiarity with the process of posting a question on this site.

0 Votes 0 ·

1 Answer

Al-9132 avatar image
0 Votes"
Al-9132 answered AryaDing-MSFT commented

Hi

When the device language is english, this Chinese character do not display.

As for code, there is nothing special on the page/map level.
Bing map control just sits in a grid. When the Map page is navigated to it displays XAML circles at locations on the map.

Bing Map control details:
Name: Bing Maps for C#, C++, or Visual Basic
FileType: SDK
Identity: Bing.Maps.Xaml, Version=1.313.0825.0
Path: C:\Users\myself\AppData\Local\Microsoft SDKs\Windows\v8.1\ExtensionSDKs\Bing.Maps.Xaml\1.313.0825.0\
Resolved: True
Version: 1.313.825.0

//-----------------------

XAML MapPage.xaml

<Grid >

 <local:MapView x:Name="mapViewControl" Zoom="15" 
                    Credentials="MyCredentialsUplrgw3Gn4fhk8m_P_etc" 
                    MapServiceToken="q_SOME_Tokenc4cJuixLOpEJ_lw" />

</Grid>

...and in the Code behind is MapPage.xaml.cs

public sealed partial class MapPopup : Page
{
protected override void OnNavigatedTo(NavigationEventArgs e)
{
// get data.

     foreach(dataItem in dataItems)
     {
         mapViewControl.AddPushpin(position, data); // Set the data up in the map.
     }
 }

}


MapView.cs file

public class MapView : Grid, INotifyPropertyChanged
{
private Bing.Maps.Map _map;
private Bing.Maps.MapLayer _pinLayer;

 public string Credentials{...}
 public string MapServiceToken{...}
 public double Zoom{...}

 public MapView()
 {
     _map = new Map();
             _map.Language = lang; // this is taken from GlobalizationPreferences.Languages[0];
                
     _pinLayer = new MapLayer();
             //_pinLayer.Language = lang; // These were added later, but have no effect.
             _map.Children.Add(_pinLayer);

             this.Children.Add(_map);
 }

 public void AddPushpin(BasicGeoposition location, List<object> displayInfo, string text = "")
 {
     CustomPin customPin = new CustomPin(); // a xaml control circle with a custom drawn tooltip
     customPin.DataContext = (CustomDataObject)displayInfo[0];

     Bing.Maps.MapLayer.SetPosition(customPin, location.ToLocation());
             _pinLayer.Children.Add(customPin);    
 }

}


Also as mention in the original post

In the application's OnLaunched() method

ApplicationLanguages.PrimaryLanguageOverride is set to the current language (GlobalizationPreferences.Languages[0]) .

Subsequently when we initialise the Bing.Maps.Map control we also set the Map.Language to be the same. This does not help.

@AryaDing-MSFT

(Are these Chinese language sets embedded with the Bing map control? How can we override to the devices preferred language?)

· 7
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

Should make it clear that the Chinese characters appear in Bing Map control dropdown and map-scale that are displayed as part of the map control.

86302-image1-app-1.png


0 Votes 0 ·
image1-app-1.png (221.4 KiB)

@Al-9132 Could you please try to override the default locale in your MapActivity.onCreate method? For example(English (en)_United States (US)): Locale.setDefault(new Locale("en"," US"))

0 Votes 0 ·

When the Bing Map 8.1 Control is initialised, at that moment I am resetting the…

1) app's PrimaryLanguageOverride when the Bing Map is being initialised.
2) the Bing Map’s Language property (property of the FrameWorkElement)
3) Also tried setting these again once at Map is Loading and Loaded events.

none of these resolve the issue. The Chinese characters appear then on-navigating away and coming back the Map display English (en-US) and not the selected language (which is Spanish es-ES).

Also, the App is coded c# & XAML

help is apricated

0 Votes 0 ·
Show more comments