4 Replies Latest reply on Jun 10, 2012 6:43 AM by CamelCase

    UTF8 not supported in scriptstep Insert From URL

    kalle_samuelsson

      Summary

      UTF8 not supported in scriptstep Insert From URL

      Product

      FileMaker Pro

      Version

      12.0.1

      Operating system version

      MacOSX Lion, Windows7

      Description of the issue

      When using the scriptstep Insert From URL and specifying GET-parameters to send with the request there is no UTF8 support fo the values in the parameters.

      Example 1 (Google Geocode Service):
      Insert From URL[ "http://maps.googleapis.com/maps/api/geocode/json?address=flöjelbergsgatan20&sensor=false&region=se" ]

      This does not work, google returns "No results". Notice the swedish character ö (&ouml) in the address parameter send with the request.

      Example 2 (Google Geocode Service):
      Insert From URL[ "http://maps.googleapis.com/maps/api/geocode/json?address=flojelbergsgatan20&sensor=false&region=se" ]

      This example works and returns address objects as json formated string. We changed the swedish character ö (&ouml) to a simple o (removed the dots).

      It does not matter if we use GetAsURLEncoded() to contain/convert the URL string.

      I do not know if FMI considers this a bug since the manual says nothing about UTF8 support for the scriptstep Insert From URL, but we sure hope you will add UTF8 support in 12.0.2!

      Steps to reproduce the problem

      1: Create a textfield called Result

      2: Create a script called Geocode

      3: Add scriptstep Insert From URL to the script Geocode

      4: Make the Result the target field for the scriptstep

      5: Set this string as the URL to fetch result from
      http://maps.googleapis.com/maps/api/geocode/json?address=flöjelbergsgatan20&sensor=false&region=se

      6: Save the script, goto browse mode and run the script

      Expected result

      {
         "results" : [
            {
               "address_components" : [
                  {
                     "long_name" : "20A",
                     "short_name" : "20A",
                     "types" : [ "street_number" ]
                  },
                  {
                     "long_name" : "Flöjelbergsgatan",
                     "short_name" : "Flöjelbergsgatan",
                     "types" : [ "route" ]
                  },
                  {
                     "long_name" : "Mölndal",
                     "short_name" : "Mölndal",
                     "types" : [ "administrative_area_level_2", "political" ]
                  },
                  {
                     "long_name" : "Sverige",
                     "short_name" : "SE",
                     "types" : [ "country", "political" ]
                  },
                  {
                     "long_name" : "43137",
                     "short_name" : "43137",
                     "types" : [ "postal_code" ]
                  },
                  {
                     "long_name" : "Mölndal",
                     "short_name" : "Mölndal",
                     "types" : [ "postal_town" ]
                  }
               ],
               "formatted_address" : "Flöjelbergsgatan 20A, 431 37 Mölndal, Sverige",
               "geometry" : {
                  "location" : {
                     "lat" : 57.67623569999999,
                     "lng" : 12.00851110
                  },
                  "location_type" : "ROOFTOP",
                  "viewport" : {
                     "northeast" : {
                        "lat" : 57.67758468029150,
                        "lng" : 12.00986008029150
                     },
                     "southwest" : {
                        "lat" : 57.67488671970849,
                        "lng" : 12.00716211970850
                     }
                  }
               },
               "partial_match" : true,
               "types" : [ "street_address" ]
            }
         ],
         "status" : "OK"
      }

      Actual result

      {
         "results" : [],
         "status" : "ZERO_RESULTS"
      }

      Exact text of any error message(s) that appear

      No error message, simply no records found because the ö character in the address GET param is not passed correctly

      Configuration information

      My operating system is set to Swedish, so is FileMaker Pro Advanced

      Workaround

      Try changing the ö character to a o. Not a good workaround but at least it is something.

        • 1. Re: UTF8 not supported in scriptstep Insert From URL
          james_quiggins

          Hello Kalle Samuelsson:

          Thank you for posting.

          When inputting the URL you provided in Safari I am also denied.  The result I get is:

           

          {

             "results" : [],

             "status" : "ZERO_RESULTS"

          }

           

          If I change the charter you suggest, then Safari's result changes to what you would expect as the result. 

          If possible, can you open the link in a web browser and report the result you get?

          http://maps.googleapis.com/maps/api/geocode/json?address=flöjelbergsgatan20&sensor=false&region=se 

          TSwildcat,

          FileMaker Inc.

          • 2. Re: UTF8 not supported in scriptstep Insert From URL
            kalle_samuelsson

            Hi TSwildcat!

            Thank you for your reply. When I open the URL in Safari, Firefox or Chrome I get a populated JSON respons that looks like this

            {
               "results" : [
                  {
                     "address_components" : [
                        {
                           "long_name" : "20A",
                           "short_name" : "20A",
                           "types" : [ "street_number" ]
                        },
                        {
                           "long_name" : "Flöjelbergsgatan",
                           "short_name" : "Flöjelbergsgatan",
                           "types" : [ "route" ]
                        },
                        {
                           "long_name" : "Mölndal",
                           "short_name" : "Mölndal",
                           "types" : [ "administrative_area_level_2", "political" ]
                        },
                        {
                           "long_name" : "Sverige",
                           "short_name" : "SE",
                           "types" : [ "country", "political" ]
                        },
                        {
                           "long_name" : "43137",
                           "short_name" : "43137",
                           "types" : [ "postal_code" ]
                        },
                        {
                           "long_name" : "Mölndal",
                           "short_name" : "Mölndal",
                           "types" : [ "postal_town" ]
                        }
                     ],
                     "formatted_address" : "Flöjelbergsgatan 20A, 431 37 Mölndal, Sverige",
                     "geometry" : {
                        "location" : {
                           "lat" : 57.67623569999999,
                           "lng" : 12.00851110
                        },
                        "location_type" : "ROOFTOP",
                        "viewport" : {
                           "northeast" : {
                              "lat" : 57.67758468029150,
                              "lng" : 12.00986008029150
                           },
                           "southwest" : {
                              "lat" : 57.67488671970849,
                              "lng" : 12.00716211970850
                           }
                        }
                     },
                     "partial_match" : true,
                     "types" : [ "street_address" ]
                  }
               ],
               "status" : "OK"
            }

             

            Could it be the locale/language settings of MacOS that gives us diffrent behavior in this case? Anyway, on my computer, the URL works if entered in safari but fails when used in FileMakers scriptstep "Insert From URL". 

            I tried the URL in IE9 on windows7 in Paralells and it returnes the same result as you get. An empty JSON result. 

            Do you know if the scriptstep performes a simple cURL request in the background? Or is there some special library that FMP uses in this case?

            Thanks again

            • 3. Re: UTF8 not supported in scriptstep Insert From URL
              james_quiggins

              Hello Kalle Samuelsson:

              Thank you for posting.

              I am getting the same behavior in Windows/Mozilla as OS X/Safari this is also what FileMaker sees for that URL ( See attached screen shot )

              What version of Safari are your using? I'm using 5.1.2

              If you change your language settings in MacOS to Windows/US do you get the same behavior that I am experiencing?

              TSwildcat,

              FileMaker Inc.

              • 4. Re: UTF8 not supported in scriptstep Insert From URL
                CamelCase

                I think some of your errors may simply have been due to the fact that you had concatenaded the street name and street number without a space or other separator. There's no street called "flöjelbergsgatan20".

                This works fine for me (OS X 10.6.8, OS region: United States, Safari 5.17) if I add a little extra twist in the URL to "force" UTF-8:  [URL]http://maps.googleapis.com/maps/api/geocode/json?address=flöjelbergsgatan%2020&sensor=false&region=se[/URL]

                 

                You can possibly also try to add a little extra twist in the URL to "force" UTF-8 and Swedish:  [URL]http://maps.googleapis.com/maps/api/geocode/json?address=flöjelbergsgatan%2020&sensor=false&region=se&hl=sv&ie=UTF8[/URL] - but I don't need to do that to make it work for me.