Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6800671
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T18:59:53+00:00 2026-05-26T18:59:53+00:00

The response body of HTTP requests using the native ‘http’ module, displays question mark

  • 0

The response body of HTTP requests using the native ‘http’ module, displays question mark characters for unicode chars, instead of their actual value. Here’s the basic snippet of code that I’m running.

var http = require('http');
var google = http.createClient(80, 'www.google.it');
var request = google.request('GET', '/',
{
 'host': 'www.google.it',
}
  );
request.end();
request.on('response', function (response) {
  response.setEncoding('utf8');
  response.on('data', function (chunk) {
    console.log(chunk);
  });
});

In the response there’s a specific word that starts with “Pubblicit“. Its last letter is a weird character that shows as a question mark to me. The word should be Pubblicità, instead it is displyed as Pubblicit?.

I have also tried outputting the data using .toString():

console.log(chunk.toString());

or

console.log(chunk.toString('utf8'));

But I’m getting the same results.

Any idea?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-26T18:59:53+00:00Added an answer on May 26, 2026 at 6:59 pm

    Reason maybe that, if we do not specify a “googleKnownAsUTF8OK” user-agent on request header, google would response a html doc with content-type of ISO-8859-1(for old browsers,bots?i dont know), so decode the response buffer by “binary” is correct.

    But, if we decode a buffer encoded in ISO-8859-1 by utf8, then the byte 0xe0(à) implies “form a character by 3bytes in a row”, it is a malformed character in our case, so a few unexpected characters(depending on the environment) was displayed.

    We may try “Mozilla/5.0” as value of user-agent. Good luck.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to print out the body of a HTTP response using Python. Here
Here is my response envelope: <s:Envelope xmlns:s=http://schemas.xmlsoap.org/soap/envelope/> <s:Body> <s:Fault> <faultcode>s:Client</faultcode> <faultstring xml:lang=en-US>The creator of
Modifying the HTTP Response Using Filters
Background I've been timing some HTTP requests via the CLI using time and tools
Response to : Regular Expression to find a string included between two characters while
When I call Response.Redirect(someUrl) I get the following HttpException: Cannot redirect after HTTP headers
In @mmalc's response to this question he states that In general you should not
Based on the response to this question: Why does C++ have header files and
If I have a raw HTTP response as a string: HTTP/1.1 200 OK Date:
I'm using node.js to make a http request to a host. I found the

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.