Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

103
Vistas
How do I decode characters from strings in polymer data binding?

Problem: I am currently working with polymer data binding and I have an apostrophe character that is showing up as \x27 on the client side. On the server side I'm sending back the data with owasp's java encoder: Encode.forJavaScript(string)

Code: (I've simplified it for the the sake of brevity.)

<dom-module id="x-custom">

  <template>
    My name is <span>[[_decodeName(personData.NAME)]]</span>
  </template>

  <script>
    Polymer({
      is: 'x-custom',
      properties: {
        personData: Object
      },
      ajaxLoaded: function(data) {
        // I've also tried putting the decodeName logic here and acting directly on this.personData.NAME
      },
      _decodeName: function(name) {
        return name.replace(new RegExp(String.fromCharCode(92)+"x27", "g"), "'");
      }
      ...
    });
  </script>

</dom-module>

What I've tried: I've tried computed data binding by writing a function that would replace this. That function has had several different implementations. I've also tried directly putting the logic of that function in the ajaxLoaded function which I believe gets called after all the data is returned from the server? As far as the logic of the _decodeName() function, I've tried using various different methods of replace and replaceAll and I've also tried decodeURIComponent(). The frontend name which includes an apostrophe is still showing up as \x27

Expected Output: I'd like the output on the front end to display as an apostrophe character and not \x27

about 4 years ago · Juan Pablo Isaza
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda