强制Google以英语返回XML日历Feed? [英] Forcing Google to return an XML Calendar feed in English ?
问题描述
我正在为访问Google日历的朋友做一个小应用程序。在Visual Studio 2010中开发它,作为WinForms项目,针对FrameWork 3.0编译,所以我的朋友可以在运行Win XP的PC上使用它。我位于S.E.亚洲。
由我的朋友创建的Google日历使用英语为其所有条目。
我成功使用典型的WebRequest和StreamReader对象捕获Calendar的XML:没问题。
问题是返回的XML包括以非编码的日历事件条目数据-Roman character Asian字体: 我认为这种情况正在发生,因为Google正在读取我的IP地址 ,并且决定我必须要将事件数据恢复到本机字符集中我所在的国家。
观察:
0。改变从https:到http:的日历链接前缀对返回的XML没有影响。
1。在当前返回XML我可以看到#1234格式的Unicode编码字符,亚洲非罗马字体的和字形。
< b> 2. 在日历链接的末尾添加?lan = en不结果仅限英文XML。这是我在Google开发者网站上找到的一个建议。
3。如果我启动Chrome并输入日历Feed的链接:全部XML内容仅以英文返回。所以这个问题在某种程度上特定于从.NET创建WebRequest
4。如果我在Internet Explorer 9中尝试链接,生成的页面 显示非罗马字母内容。
因此,问题是:如何强制Google返回英文-language仅来自于使用WebRequest从.NET下拉XML格式的Google日历源。
谢谢!比尔
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
推荐答案
不太棘手。 :-)如果您查看Google高级搜索页面,您会找到语言字段: http://www.google.com/advanced_search [ ^ ] :-)。
-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
追加
?hl=en
到我工作的URL。
这篇关于强制Google以英语返回XML日历Feed?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!