Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

201
Views
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
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!