Click here to Skip to main content
15,881,898 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
I am doing a small application for a friend that accesses his Google calendar. Developing it in Visual Studio 2010, as a WinForms project, compiled against FrameWork 3.0, so my friend can use it on a PC running Win XP. I am located in S.E. Asia.

The Google Calendar created by my friend uses English for all its entries.

I successfully capture the Calendar's XML using the typical WebRequest, and StreamReader objects: no problem there.

The problem is that the XML returned includes Calendar Event entry-data encoded in a non-Roman character Asian font: I assume this is happening because Google is reading my IP address, and "decides" I must want the Event data back in the native character set of the country I am in.

Observations:

0. changing the Calendar link prefix from "https:" to "http:" has no effect on the XML returned.

1. In the current XML returned I can see both Unicode coded characters in "#1234" format, and glyphs in the Asian non-Roman font.

2. Adding "?lan=en" to the end of the Calendar link does not result in English-only XML. That was one suggestion I found on Google's developer site.

3. If I launch Chrome and enter the link to the calendar feed: all XML content is returned in English only. So the problem is somehow specific to making a WebRequest from ".NET"

4. If I try the link in Internet Explorer 9, the resulting page does display non-Roman alphabet content.

So, the question is: how to force Google to return English-language only results from pulling down a Google Calendar feed in XML format, from .NET using WebRequest.

thanks ! Bill
Posted
Updated 2-Jan-13 14:01pm
v3
Comments
Sergey Alexandrovich Kryukov 2-Jan-13 20:05pm    
Some notes:

OK, could you show the URL, and, I don't know, maybe some other detail? Basically, this is all internal business of the site/service, you should understand it. It will respond with whatever "it wants". The question is: what?

HTTP or HTTPS is not "prefix"; this is "scheme". They use different protocols, and, in general case, if the rest of URI is the same, what you get are conceptually two different Web sites.
If you have a desired result in Chrome, you can fully simulate it using HttpWebRequest. You can try to spy on packages. You can even make your own spy. The easiest way it to make it a proxy code and set up the browser with that proxy.

Anyway, you can probably find all the ends if you put some effort in it. Need more help?

—SA

Not too tricky. :-) If you look at Google advanced search page, you will find the field "Language": http://www.google.com/advanced_search[^] :-).

—SA
 
Share this answer
 
Comments
BillWoodruff 2-Jan-13 19:56pm    
Thanks, Sergey, You may have answered before I revised the question.

In this case, this is about accessing an RSS feed using .NET via WebRequest; it is not about doing a browser-search. In a Chrome browser-search you can use syntax like "&lr=lang_en" to force English language only results.

And, as I note in the revised question: in this case adding "?lan=en" doesn't work either.

Please see the newly revised question, if you have time.

yrs, Bill
Sergey Alexandrovich Kryukov 2-Jan-13 20:05pm    
Sure. I added some comments, but to the modified questions...
—SA
Appending
?hl=en
to the URL worked for me.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900