Skip to main content
Solved

accents in parameter with direct url


bgeorges
Contributor
Forum|alt.badge.img+5

I have a workspace on FME Server that sometimes will receive strings with accent as a parameter.

I am calling the workspace with the direct url from a javascript application. I serialize the parameters to be valid in the direct url.

            serialize = function(obj) {
              var str = [];
              for (var p in obj) {
                if (obj.hasOwnProperty(p)) {
                  str.push(encodeURIComponent(p) + "=" + encodeURIComponent(obj[p]));
                }
              }
              return str.join("&");
            }

So the string parameter NomProjet = Test ML é become NomProjet=Test%20ML%20%C3%A9 

However, at the end of the workspace, I write the value of the parameter in an Excel file, but the value is blank.

If the parameter does not have accent the output is correct.

What is the problem here? What can be done?

Best answer by nielsgerrits

You probably need to decode the text back from URL Encoding. You can use a TextDecoder for this.

View original
Did this help you find an answer to your question?

4 replies

nielsgerrits
VIP
Forum|alt.badge.img+54
  • Best Answer
  • July 5, 2019

You probably need to decode the text back from URL Encoding. You can use a TextDecoder for this.


bgeorges
Contributor
Forum|alt.badge.img+5
  • Author
  • Contributor
  • July 5, 2019
nielsgerrits wrote:

You probably need to decode the text back from URL Encoding. You can use a TextDecoder for this.

I tried your idea with encoding type set to URL (percent encoding) and weirdly the output is now 54657374204D4C20E9 instead of being blank for the value Test ML é


bgeorges
Contributor
Forum|alt.badge.img+5
  • Author
  • Contributor
  • July 5, 2019
nielsgerrits wrote:

You probably need to decode the text back from URL Encoding. You can use a TextDecoder for this.

It appears that the string with accent are encoded in hexadecimal and that I have to decode to latin-1 to make it works.

 

I dont know why it's not encoded in utf-8 at first !?!?


nielsgerrits
VIP
Forum|alt.badge.img+54
bgeorges wrote:

It appears that the string with accent are encoded in hexadecimal and that I have to decode to latin-1 to make it works.

 

I dont know why it's not encoded in utf-8 at first !?!?

Me neither :) but happy it works.


Cookie policy

We use cookies to enhance and personalize your experience. If you accept you agree to our full cookie policy. Learn more about our cookies.

 
Cookie settings