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

247
Vistas
javascript btoa error 'The String contains an invalid characters'

A login screen for user email and password is generating an error that I have not been able to reproduce. I have looked extensively for a solution, and everything I see is referencing atob or urlEncoding issues. Virtually nothing about btoa.

  <input type="password" id="loginPassword" placeholder="password" class="registerFields"  ng-model="loginInfo.password"></input>


  $scope.userLogin = function() {
    // check user on back end
    var pass64 = btoa($scope.loginInfo.password) ;  // <-- error generated here
    ....
  } ;

I am encoding the string to pass back to my server, which decodes the string using PHP then properly compares the password to what is stored in the DB.

  $user_password = base64_decode($inObj['upass']) ;

  if (password_verify($user_password,$rows[0]['user_password'])) {
     ...
  }

Everything I have been reading is the error that is being reported would be caused by users entering Unicode characters into the password field. Is this the only case that could cause this error or are there others? Trying to replicate the error I have entered about a dozen unicode strings, even the enter key (U+2386) but every example I am testing with does not produce an error.

  1. What characters or strings could be causing this so that I can try to replicate it?
  2. What can I do to prevent the error OR, if possible, prevent unicode characters from being entered as a password (is that even a good idea) ?
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