Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
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 2-Jan-13 12:49pm
Edited 2-Jan-13 14:01pm
v3
Comments
Sergey Alexandrovich Kryukov at 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
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 1

Not too tricky. Smile | :) If you look at Google advanced search page, you will find the field "Language": http://www.google.com/advanced_search[^] Smile | :) .
 
—SA
  Permalink  
Comments
BillWoodruff at 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 at 2-Jan-13 20:05pm
   
Sure. I added some comments, but to the modified questions...
—SA
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 2

Appending
?hl=en
to the URL worked for me.
  Permalink  

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

  Print Answers RSS
0 Sergey Alexandrovich Kryukov 718
1 OriginalGriff 421
2 Tadit Dash 355
3 sanket saxena 329
4 Peter Leow 193
0 Sergey Alexandrovich Kryukov 12,109
1 OriginalGriff 7,326
2 Peter Leow 5,003
3 Abhinav S 4,003
4 Maciej Los 3,575


Advertise | Privacy | Mobile
Web04 | 2.8.140421.2 | Last Updated 30 Jan 2013
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Use
Layout: fixed | fluid