Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

248
Visualizações
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 à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda