Using the Moneris Hosted Tokenization, how can we get the label to display French accents?

I'm trying to setup a Moneris Hosted Tokenization to display the card number, expiration date and CVD information. I have made the changes to the IFrame to display them along with the corresponding labels. Since the application will serve both english and french clients, I have a resource string defined in my Asp.Net/C# web app for each language. 

I have made the changes to generate the IFrame src string and for each label, I feed it the resource string with the appropriate language. When the application is in english, the text appears correct but when the language is in french, the accents get replaced with different characters. As an example:

src="...&cvd_label=Code de sécurité CVV2&..." will appear in the HTML code of the IFrame but for that label, I see the following:

<label for="monerisCVDInput" class="monerisInputLabel" id="monerisCvdLabel">Code de sécurité CVV2</label>

My web application is setup to use UTF-8 and if I send the text to a textbox, the text appears correctly. Would you be able to tell me if the text will need to be encoded a certain way when I create the text in the src line sent to Moneris?

  • Found the answer, I needed to encode the text in the following manner HttpUtility.UrlEncode("Code de sécurité CVV2", Encoding.GetEncoding("ISO-8859-1"))
  • In reply to PierreA:

    That's exactly it... so first html encoded then URL encoded since its passed as a URL parameter.
  • In JavaScript I was able to display special characters like this :

    let panLabel = "&pan_label=" + encodeURIComponent("s&eacute;curit&eacute;"); //sécurité
  • In reply to RR_Moneris:

    Can you please give an example. DO you mean encode label and then encode the whole URL.

  • In reply to devrkr:

    Hi,

    What I mean is special characters should be encoded when passed to us. So for example
    é HTML encoded would be &eacute;
    &eacute; URL encoded would be %26eacute%3B

    Depending on which language you are using there may be libraries that do it to the string as a whole.
  • In reply to RR_Moneris:

    In JS, the only way I could get this to work was to `escape(myFrenchLabel)`, but this doesn't work 100% of the time. One of my labels has an apostrophe. It's being escaped just fine: the string goes from "Date d'expiration (MMAA)' to "Date%20d%27expiration%20%28MMAA%29" but once it's rendered within the iFrame the apostrophe renders an underscore instead. It looks like "Date d_expiration (MMAA)".

    Any ideas why this might be? Do I need to change how I'm encoding the string that I'm passing over to you guys?
  • In reply to JesseV:

    So you say most the time it works but not always? Is it specific browsers that renders it with an underscore?
  • In reply to RR_Moneris:

    What I'm saying is that whenever I pass in a label that contains an apostrophe, the apostrophe renders as an underscore within the Moneris iframe. This happens for all browsers.

    Should I be doing something extra other than just `escape(myLabel)` to encode the string that I'm passing over?
  • In reply to JesseV:

    Try using the html entity name for the apostrophe: &apos;

    URL encoded it should be %26apos%3B
  • In reply to RR_Moneris:

    Ugh... Sorry I totally missed that part about HTML encoding the strings before URL encoding them. This worked.
  • In reply to JesseV:

    No worries, glad it works.