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

  • Home
  • SEARCH
  • 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 7162089
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T13:40:38+00:00 2026-05-28T13:40:38+00:00

In getting some random spanish newspaper’s index I don’t get the diacriticals properly using

  • 0

In getting some random spanish newspaper’s index I don’t get the diacriticals properly using WebRequest, they yield this weird character: �, while downloading the response from the same uri using a WebClient I get the appropriate response.

Why is this differentiation?

var client = new WebClient();
string html = client.DownloadString(endpoint);

vs

WebRequest request = WebRequest.Create(endpoint);
using (WebResponse response = request.GetResponse())
{
    Stream stream = response.GetResponseStream();
    StreamReader reader = new StreamReader(stream);
    string html = reader.ReadToEnd();
}
  • 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-28T13:40:39+00:00Added an answer on May 28, 2026 at 1:40 pm

    You’re just assuming that the entity is in UTF-8 when creating your stream-reader without explicitly setting the encoding. You should examine the CharacterSet of the HttpWebResponse (not exposed by the WebResponse base class), and open the StreamReader with the appropriate encoding.

    Otherwise, if it reads something that’s not UTF-8 as if it was UTF-8, it’ll come across octet-sequences that aren’t valid in UTF-8 and have to substitute in U+FFFD replacement character (�) as the best it can do.

    WebClient does pretty much this: DownloadString is a higher level method, that where WebRequest and its derived classes let you get in lower, it has a single call for “send a GET request to the URI, examine the headers to see what content-encoding is in use, in case you need to un-gzip or de-compress it, see what character-encoding is in place, set up a text-reader with that encoding and the stream, and then call ReadAll()“. The normal high-level-big-chunk-instructions vs low-level-small-chunk-instructions pros and cons apply.

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

Sidebar

Related Questions

I'm using some new methods that I don't usually use(random.nextInt()), so help is greatly
I want to log some seemingly random errors I'm getting in a Delphi written
My document is getting some errors when using the W3C validator because some of
I'm getting some strange behavior using COS() and SIN() libraries in Fortran 77. It
I'm getting some very strange behaviour using the following switch statement: string recognise_mti(int mti_code)
I'm using Sqlite3 in my iPhone app, I was getting some unwanted rollbacks apparently
Being some random rails dev, and getting around all those backbone/underscore javascript stuff… Backbone
a question about getting some random words out of a bigger string after it
I want to get some random records from db. There is two solution for
When I am compiling this program I am getting some random number as output..

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.