1 (edited by Andy 2017-11-24 12:01:58)

Topic: Wrong formated stringbuilder url resulting in bing 400 error

Hi there,

I just wondered why in one project the elevation was built correctly and in the other it was not.
Both projects used the exact same parameters. I even included the scene from the working one as a test.

After serveral debugging logs I saw, that the url in the working project has the lat&long values formatted correctly with ".", whereas the one not working had it formatted with "," - resulting in thinking the rest api receiving additional parameters.

I don't know why and where this wrong format is introduced... since as said, I used exact parameters, same plugin version etc.

As a workaround I wrote a little (clumsy) fix in OnlineMapsBingMapsElevation.cs:

 public override void GenerateURL(StringBuilder builder)
        {
            base.GenerateURL(builder);

            string bottomLatStr = (bottomLatitude.ToString()).Replace(",", ".");
            string topLatStr = (topLatitude.ToString()).Replace(",", ".");
            string leftLongStr= (leftLongitude.ToString()).Replace(",", ".");
            string rightLongStr = (rightLongitude.ToString()).Replace(",", ".");

            builder.Append("&bounds=").Append(bottomLatStr).Append(",").Append(leftLongStr).Append(",").Append(topLatStr).Append(",").Append(rightLongStr);
            builder.Append("&rows=").Append(rows).Append("&cols=").Append(cols);
        }

Best regards,
Andy

Re: Wrong formated stringbuilder url resulting in bing 400 error

Hello.

Most likely you or some other asset override current culture.
Or perhaps it's Unity Net 4.6 culture bug.
I did not see this bug, but yesterday I saw code that bypasses this, so this bug most likely exists.

Try this:

private void Awake() {
        Thread.CurrentThread.CurrentCulture = CultureInfo.GetCultureInfo("en-US");
        Thread.CurrentThread.CurrentUICulture = CultureInfo.GetCultureInfo("en-US");
}
Kind Regards,
Infinity Code Team.

Boost your productivity a lot and immediately using Ultimate Editor Enhancer. Trial and non-commerce versions available.

Re: Wrong formated stringbuilder url resulting in bing 400 error

This fixed it also. Thank you.
As far as this works for me right now, I wonder what would happen if you have language switching or something like that.

Re: Wrong formated stringbuilder url resulting in bing 400 error

Some providers support multiple languages.
Use OnlineMaps.language to specify language code.
http://infinity-code.com/doxygen/online … b33477ddc1

Kind Regards,
Infinity Code Team.

Boost your productivity a lot and immediately using Ultimate Editor Enhancer. Trial and non-commerce versions available.

Re: Wrong formated stringbuilder url resulting in bing 400 error

It's not a Unity bug - it's actually a bugfix which results in that issue:
https://feedback.unity3d.com/suggestion … s-with-cor