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

251
Vistas
Using Javascript, how do I convert a binary string (1s and 0s) back into a Unicode character?

I'm new here. Using Javascript, I have successfully converted a Unicode character into a binary string (i.e., into 1s and 0s). Now, how would I convert that string back into the original Unicode character (UTF-8 I think). I have found a few code examples--but unfortunately the conversions do not work in converting the binary string back into the original character.

Here's the binary string (which is a "thumbs up" emoji):

11110000100111111001000110001101

Thanks, and any code examples you could prove (in pure Javascript) would be most welcome. Thanks.

about 4 years ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

0

Basic Google-fu:

  1. Split large string in n-size chunks in JavaScript
  2. Parse binary string as byte in JavaScript
  3. Conversion between UTF-8 ArrayBuffer and String

Putting above together (sorry for my poor JS skills):

function chunkSubstr(str, size) {
  const numChunks = Math.ceil(str.length / size)
  const chunks = new Array(numChunks)

  for (let i = 0, o = 0; i < numChunks; ++i, o += size) {
    chunks[i] = parseInt(str.substr(o, size),2)
  }

  return chunks
}
function uintToString(uintArray) {
    var encodedString = String.fromCharCode.apply(null, uintArray),
        decodedString = decodeURIComponent(escape(encodedString));
    return decodedString;
}

console.log(uintToString(chunkSubstr("11110000100111111001000110001101", 8))); // 👍

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