非拉丁字符

问题描述:

我有谷歌驱动器,带根两个文件夹 - 用拉丁文和非拉丁(西里尔文)名称:非拉丁字符

enter image description here

当我搜索谷歌驱动器根与

String query = "'root' in parents and title='Archive' and trashed=false"; 
drive.files().list().setQ(query).execute() 

它给了我Archive文件夹的元数据,因为它下面的图片:

enter image description here

但如果我更改查询字符串'root' in parents and title='Архив' and trashed=false(西里尔字母的文件夹名称),它给我什么:

enter image description here

我使用谷歌云端硬盘API的V2按照库的方式:

com.google.apis:google-api-services-drive:v2-rev154-1.18.0-rc 
com.google.api-client:google-api-client:1.18.0-rc 
com.google.api-client:google-api-client-android:1.18.0-rc 
com.google.http-client:google-http-client:1.18.0-rc 
com.google.http-client:google-http-client-gson:1.18.0-rc 

这是一个错误,或者我应该使用搜索名称中的非拉丁字符的一些编码?如果最后Google在文档中提到它的位置!

更新V3 问题仍然存在。经过了以下库:

com.google.apis:google-api-services-drive:v3-rev80-1.22.0 
com.google.api-client:google-api-client:1.22.0 
com.google.api-client:google-api-client-android:1.22.0 
com.google.http-client:google-http-client:1.22.0 
com.google.http-client:google-http-client-gson:1.22.0 

第二次更新:一些研究与API Explorer V2表明,问题是在俄罗斯首都字母。如果在文件夹名称ATLEAST一个大写字母:'root' in parents and title='папкА' and trashed=false有这样的文件夹名称的查询提供了什么:

{ 
"kind": "drive#fileList", 
"etag": "\"iqKjQ5Hr8wRO8SSHNW8KBrJOqxI/skD00QgZZ0FB6U5ufzrrxrFjqyA\"", 
"selfLink": "https://www.googleapis.com/drive/v2/files?q='root'+in+parents+and+title%3D'%D0%BF%D0%B0%D0%BF%D0%BA%D0%90'+and+trashed%3Dfalse", 
"incompleteSearch": false, 
"items": [] 
} 

如果大写字母在文件夹名称不存在:'root' in parents and title='папки' and trashed=false查询返回正确的json与文件夹的元数据。 V3也是如此。 因此,问题出在Drive服务器

第三次更新:查询'root' in parents and title contains 'папкА' and trashed=false返回正确答案!

+0

@noogui你的意思是避免在文件夹名称中使用非拉丁字符!? – isabsent

+0

如果您询问'drive.files()。get(folderId).execute()'时显示非拉丁字符的项目,为什么我们应该避免使用几乎相同的查询来查找它们'drive.files().list() .setQ(查询).execute()'?我想Google应该解决这个问题。 – isabsent

+0

我的意思是 - 如果您询问'drive.files()。list()。setQ(''root'in parents and trashed = false')时显示带有非拉丁字符的项目。execute()'为什么我们应该避免用几乎相同的查询'drive.files().list().setQ('父'和'title'='Архив'和trashed = false')来查找它们。这看起来不合理。我想Google应该解决这个问题。 – isabsent

对于你的使用案例,我试过Drive API version 3 Try-it中的拉丁符号,我认为它的工作原理。

所以我有这个文件夹命名为“ɞʚᵷ”,我希望是一个拉丁文符号,并做了一个查询。

name contains 'ɞʚᵷ' and mimeType = 'application/vnd.google-apps.folder' 

它的工作原理!

响应:

{ 
"kind": "drive#fileList", 
"incompleteSearch": false, 
"files": [ 
    { 
    "kind": "drive#file", 
    "id": "0Bzgk4zccNwI7TFhPLUpGdmlmVVE", 
    "name": "ɞʚᵷ", 
    "mimeType": "application/vnd.google-apps.folder" 
    } 
] 
} 

更新: 我试过命名我在俄罗斯的文件夹就像你正在使用的一个 - “Архив”,和我有同样的结果,空的结果。我认为这是Drive的局限性。请使用英文字母表来确保查询始终有效。

+0

你可以试试'name ='ɞʚᵷ'和mimeType ='application/vnd.google-apps.folder''against V3吗? – isabsent

+0

是的,它也可以工作! ; ) – noogui

+0

谢谢!如果没有人提供V2的解决方案,我会接受你的回答。你可以显示库设置为在AS中使用V3与Gradle? – isabsent