Many of my Firestore documents and collections are named in Arabic, but when I want to write security rules I noticed Arabic text is not accepted? I need help on how to fix that?
I tried many types to write the Arabic collection names in the Security rules, but not accepted by Firebase and I couldn't any useful solution on the Internet for this case.
firebaser here: I thought we'd covered this before, but can't find it - so I checked with the engineering team.
The path segment in your rules definition may only contain [A-Za-z0-9]
plus some special characters like *
and %
. For other characters, you can should use hex/URL escaping (using %).
So if I have a collection named één, I'd have a rule matching it as:
match /%C3%A9%C3%A9n/{docid} {
allow read;
}
The %C3%A9%C3%A9n
in there is the URL encoding of the collection name één
, in this case gotten by doing encodeURI('één')
.