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

204
Vistas
Express & Node Server wont recognize UTF-8 Chars

i hope you are doing well. Today I have this problem: I have this 2 functions:

const search_words = async (word, question) => {
    let options = {
        method: 'GET',
        url: `https://google.com/complete/search?client=psy-ab&gl=fr&lr=lang_fr&q=${word}%20${question}`,
        headers: {
            'Accept': 'application/json; charset=utf-8',
            'Content-Type': 'application/json',
        }
    };

    return axios.request(options).then(function (response) {
        console.log(response.data[1])
        return response.data[1]
    }).catch(function (error) {
        console.log(error);
    });
}

app.post('/api/related-questions', async (req, res) => {
    const question = req.body.question

    let questionsReturn = {}

    let qui = search_words('qui', question).then(res => questionsReturn['qui'] = res)
    let quoi = search_words('quoi', question).then(res => questionsReturn['quoi'] = res)
    let pourquoi = search_words('pourquoi', question).then(res => questionsReturn['pourquoi'] = res)
    let que = search_words('que', question).then(res => questionsReturn['que'] = res)
    let ou = search_words('ou', question).then(res => questionsReturn['ou'] = res)

    Promise.all([qui, quoi, pourquoi, que, ou]).then(() => {
        res.json(questionsReturn)
    })
})

If I make the request to the Google API with Postman, I will get the searches with the correct chars: enter image description here

But when I make it with Axios and my func I get this chars: enter image description here

Im missing any configuration ? Thanks for reading <3

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