Google Code ~ DocsListUploader

Google Code ~ DocsListUploader
最近工作不是很忙,在整理资料的时候需要用到DocsListUploader,这个工具是Google Code的一个Sample应用.发现无论是其1.0还是1.1版本对中文文件名的支持极其差,所以自己打算去研究一下.
问题的产生是在Google.GData.Client.Service类中Line 909: r.Slug = slugHeader;
程序会调用Google.GData.Client.Request中Line 465: this.slugHeader = Utilities.EncodeSlugHeader(value);
/// helper to read in a string and Encode it according to
/// RFC 5023 rules for slug headers
/// name="slug">the Unicode string for the slug header
/// ASCII encoded string
public static string EncodeSlugHeader(string slug)
if (slug == null) return "";
Byte[] bytes =EncodeStringToUtf8(slug);
if (bytes == null) return "";
StringBuilder returnString = new StringBuilder(256);
foreach (byte b in bytes)
if ((b 0x7E))
returnString.AppendFormat(CultureInfo.InvariantCulture, "%{0:X}", b);
returnString.Append((char) b);
} return returnString.ToString();
继续找RFC 5023发现,在这个规范中会对slug进行UTF8 Encode,所以如果文件名是"测试.txt"就会被替换成"%E6%B5%8B%E8%AF%95.txt",这也就是为什么当用此工具上传中文名文档后,在GDocs中显示为%E6%B5%8B%E8%AF%95.txt的原因啦.
自己试着去解决这个问题(或者自己还能开发一个小的GDocs工具,替代自己日常使用的文本编辑器),所以去找了RFC 5023,发现:

9.7. The Slug Header

Slug is an HTTP entity-header whose presence in a POST to a
Collection constitutes a request by the client to use the header’s
value as part of any URIs that would normally be used to retrieve the
to-be-created Entry or Media Resources.

Servers MAY use the value of the Slug header when creating the Member
URI of the newly created Resource, for instance, by using some or all
of the words in the value for the last URI segment. Servers MAY also
use the value when creating the atom:id, or as the title of a Media
Link Entry (see Section 9.6).

Servers MAY choose to ignore the Slug entity-header. Servers MAY
alter the header value before using it. For instance, a server might
filter out some characters or replace accented letters with non-
accented ones, replace spaces with underscores, change case, and so

9.7.1. Slug Header Syntax

The syntax of the Slug header is defined using the augmented BNF
syntax defined in Section 2.1 of [RFC2616]:

slugtext = %x20-7E LWS
Slug = "Slug" ":" *slugtext

The field value is the percent-encoded value of the UTF-8 encoding of
the character sequence to be included (see Section 2.1 of [RFC3986]
for the definition of percent encoding, and [RFC3629] for the
definition of the UTF-8 encoding).

Implementation note: to produce the field value from a character
sequence, first encode it using the UTF-8 encoding, then encode all
octets outside the ranges %20-24 and %26-7E using percent encoding
(%25 is the ASCII encoding of "%", thus it needs to be escaped). To
consume the field value, first reverse the percent encoding, then run
the resulting octet sequence through a UTF-8 decoding process.

9.7.2. Example

Here is an example of the Slug header that uses percent-encoding to
represent the Unicode character U+00E8 (LATIN SMALL LETTER E WITH

POST /myblog/entries HTTP/1.1
Content-Type: image/png
Slug: The Beach at S%C3%A8te
Authorization: Basic ZGFmZnk6c2VjZXJldA==
Content-Length: nnn

…binary data…

See Section 9.2.1 for an example of the Slug header applied to the
creation of an Entry Resource.

发现了解决的方法就是在Server端要Decode这个UTF-8编码的Slug,到此自己已无能为力,毕竟我不是管理Google Docs服务的人.
期待有朝一日有一个很好的Gdocs工具,可以让自己方便的批量上传和同步自己的文档,并且是Local GDocs.

关于Google Chrome绿化

关于Google Chrome绿化
可以按照一些指导步骤绿化,然后添加快捷方式 D:\Applications\Chrome\chrome.exe –user-data-dir="User Data";
但是仍然无法解决必要的自动升级问题 update server not available (error: 1).

Merry Christmas & Happy Every Year!

Merry Christmas & Happy Every Year!
Life is a long journey and love is a beautiful scene. What more wonderful is living with you everyday until both of you get old.
The moment I know you, I am refreshed! The moment I understand the love between us, I inspired!
Whenever, we are TOGETHER.
Wherever, I am missing you so much~