Repository navigation
DbxUserFilesRequests#searchV2 fails on Android when query contains > 2 Chinese characters #560
Description
Activity
Thanks for the report! We're investigating this issue. We'll follow up here once we have an update.
@pangzhaiwei the team is requesting additional information. Could you share the specific characters you are having issues with? Or a code snippet that triggers the error or unexpected behavior?
@alyx-db
here is testing code:DropBoxCredential dropBoxCredential = [replace with my real dropBoxCredential ] DbxClientV2 dbxClient = new DbxClientV2( DbxRequestConfig.newBuilder("replace with my app name") .withHttpRequestor(new OkHttp3Requestor(OkHttp3Requestor.defaultOkHttpClientBuilder().build())) .build() , dropBoxCredential); SearchV2Result searchResult = dbxClient.files().searchV2(query);I have a file named 红楼梦.pdf. The verification is done by checking the list returned from searchResult.getMatches().
When I test the search functionality, I observe the following:Successful Queries: If I pass the query as "红", "红楼", or "楼梦", the search returns the file correctly.
Failing Query: However, if I pass the full filename as the query, "红楼梦", the search result is empty.
Hi @pangzhaiwei
After further investigation, we’ve been unable to replicate the behavior you described. All Chinese characters and use cases you provided were tested and are working as expected in our environments.
Hi @alyx-db
Thank you for investigating and confirming that Chinese search functionality works in your testing environment. We are still experiencing the issue where a 3-character search fails to return matches, even though the file exists.Following your suggestion, we performed deep log capture on the HTTP requests sent by the client and observed a strange phenomenon that we suspect may be occurring on the server side. We hope that sharing this low-level data can help your team pinpoint the issue.
Client Setup and Log
Here is the setup code for capturing the network traffic:
DropBoxCredential dropBoxCredential = [replace with my real dropBoxCredential ]; HttpLoggingInterceptor logging = new HttpLoggingInterceptor(); logging.setLevel(HttpLoggingInterceptor.Level.BODY); OkHttpClient client = OkHttp3Requestor.defaultOkHttpClientBuilder() .addInterceptor(logging) .build(); DbxClientV2 dbxClient = new DbxClientV2( DbxRequestConfig.newBuilder("replace with my app name") .withHttpRequestor(new OkHttp3Requestor(client)) .build() , dropBoxCredential); SearchV2Result searchResult = dbxClient.files().searchV2(query);Raw HTTP Log Data
The log below shows a successful 2-character query ("红楼") and the failing 3-character query ("红楼梦") where the file (红楼梦.pdf) should have been matched.
2025-10-24 11:23:40.114 25073-25467 I --> POST https://api.dropboxapi.com/2/files/search_v2
2025-10-24 11:23:40.114 25073-25467 I Content-Type: application/json; charset=utf-8
2025-10-24 11:23:40.114 25073-25467 I Authorization: [replace with my Bearer token]
2025-10-24 11:23:40.114 25073-25467 I User-Agent: [my app name] OfficialDropboxJavaSDKv2/7.0.0
2025-10-24 11:23:40.114 25073-25467 I Content-Length: 18
2025-10-24 11:23:40.114 25073-25467 I {"query":"红楼"}
2025-10-24 11:23:40.114 25073-25467 I --> END POST (18-byte body)
2025-10-24 11:23:40.998 25073-25467 I <-- 200 https://api.dropboxapi.com/2/files/search_v2 (883ms)
... (headers) ...
2025-10-24 11:23:40.999 25073-25467 I x-dropbox-request-id: c065e993241c41eda0e740ac68faf13c
2025-10-24 11:23:41.000 25073-25467 I {"has_more":false,"matches":[... 3 matching files ...]}
2025-10-24 11:23:41.000 25073-25467 I <-- END HTTP (1670-byte body)2025-10-24 11:28:11.279 25073-25493 I --> POST https://api.dropboxapi.com/2/files/search_v2
2025-10-24 11:28:11.280 25073-25493 I Content-Type: application/json; charset=utf-8
2025-10-24 11:28:11.280 25073-25493 I Authorization: [replace with my Bearer token]
2025-10-24 11:28:11.280 25073-25493 I User-Agent: [my app name] OfficialDropboxJavaSDKv2/7.0.0
2025-10-24 11:28:11.280 25073-25493 I Content-Length: 21
2025-10-24 11:28:11.280 25073-25493 I {"query":"红楼梦"}
2025-10-24 11:28:11.280 25073-25493 I --> END POST (21-byte body)
2025-10-24 11:28:12.864 25073-25493 I <-- 200 https://api.dropboxapi.com/2/files/search_v2 (1583ms)
... (headers) ...
2025-10-24 11:28:12.865 25073-25493 I x-dropbox-request-id: 3dbb52c7d6984f508984190868faf24d
2025-10-24 11:28:12.865 25073-25493 I {"has_more":false,"matches":[]}
2025-10-24 11:28:12.865 25073-25493 I <-- END HTTP (31-byte body)@pangzhaiwei thanks for that additional information, I have passed it along to the team for further analysis. I'll follow up here once I have an update.
Hey Dropbox Team,
I'm encountering some unexpected behavior when using the Java SDK's files/search_v2 method on the Android platform, specifically with Chinese filenames.
The DbxUserFilesRequests#searchV2(String query) call on Android fails when the query contains more than two Chinese characters. The search succeeds if the query has two or fewer Chinese characters.
Environment
SDK: com.dropbox.core:dropbox-core-sdk:7.0.0
SDK: com.dropbox.core:dropbox-android-sdk:7.0.0
Platform: Android
API: /files/search_v2
Could you please take a look at the query string processing and encoding logic for Chinese characters within the Android SDK?
Thank you for your time.