Skip to content

Cannot find document when document id contains non-ascii characters #999

@CorieW

Description

@CorieW

An issue was created for this in firebase-functions-python #220, but I believe this is an issue with this project, so I'm creating an issue here.

Issue

My document id:

H67iEkcHx6Nicg5eoZbmxARLyJo2_KoX4bc4jGmTKwSGLI9GBdF46Hbt2_中餐

The last two characters are Chinese characters.

Relevant code:

event.data.after.reference.update() (here)

Error message:

google.api_core.exceptions.NotFound: 404 No document to update: projects/{project_name}/databases/(default)/documents/{collection_name}/H67iEkcHx6Nicg5eoZbmxARLyJo2_KoX4bc4jGmTKwSGLI9GBdF46Hbt2_中�"

Notes

The issue could be that the string "H67iEkcHx6Nicg5eoZbmxARLyJo2_KoX4bc4jGmTKwSGLI9GBdF46Hbt2_中餐" is being converted into "H67iEkcHx6Nicg5eoZbmxARLyJo2_KoX4bc4jGmTKwSGLI9GBdF46Hbt2_\344\270\255\351\244\220" inside the event.data.after.reference.update function. Notably, the part "\344\270\255\351\244\220" is an octal representation of the UTF-8 encoding for 中餐. To convert it, each octal sequence (e.g. \344) can be converted into hexadecimal to get \xe4\xb8\xad\xe9\xa4\x90 which is the UTF-8 byte sequence for 中餐.

Metadata

Metadata

Assignees

Labels

api: firestoreIssues related to the googleapis/python-firestore API.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions