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

314
Vistas
Check if a UTF-8 character or string can be converted into Windows-1252 in Javascript?

I need to store form data sent from the browser into a database that stores text in Windows-1252. Since modern browsers will send the form data to my backend as UTF-8, I plan to validate the input both on the browser as well as in the backend to make sure I am not storing garbage into the database.

Is there a function in Javascript that checks if a UTF-8 character or string can be converted into Windows-1252 so that I can warn the user that an illegal character was detected before form submission? For example let's say I have a function is_w1252(unicodeChar) that has the following inputs/outputs:

utf8 Input | Output
----------------------------------------------------------
'a'        | true
'è'        | true (has windows-1252 equivalent: 0xE8)
'fèèbar'   | true
'👍'       | false (no windows-1252 equivalent)

Is there such a thing?

My PHP backend is much more simple; I plan to use iconv() to convert the form data into Windows-1252 before storing it into the database.

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