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

280
Visualizações
Why does atob fail in Safari and Chrome on this Base 64 string?

Here is an example bit of Javascript to reproduce the issue:

let a = "qNqrdXUrk5S7dCM1MAYH3qSVDXznb-6prQoGqiACR10=";
console.log(atob(a));

In Safari we get:

Invalid Character Error: the string contains an invalid character.

In Chrome we get:

Uncaught DOMException: Failed to execute 'atob' on 'Window': The string to be decoded is not correctly encoded.

I can decode the above string on base64decode.org. By the way the value is intended to be a random sequence of bytes, not any sort of human readable string. atob ought to handle that.

about 4 years ago · Juan Pablo Isaza
1 Respostas
Responde à pergunta

0

From the "Design" section of that same page:

MIME's Base64 implementation uses A-Z, a-z, and 0-9 for the first 62 values, as well as "+" and "/" for the last two. Other variations, usually derived from Base64, share this property but differ in the symbols chosen for the last two values; an example is the URL and filename safe "RFC 4648 / Base64URL" variant, which uses "-" and "_".

JS uses the MIME-based encoding, and therefore the - in your initial string is invalid. It likely works on the decoder on the site by detecting which characters are in the input string and choosing the proper decoding format versus blindly using atob().

about 4 years ago · Juan Pablo Isaza Relatório
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