是否可以在表情符号字符上查询 Firebase?

Is it possible to query Firebase on emoji characters?

我想从 swift 执行一个原生支持表情符号的 firebase 查询。但是,在执行以 ~ 结尾的查询时,我注意到奇怪的行为,其中跳过了与表情符号相关的结果。以下是我要执行的查询示例。其中起始值是某个名称,结束值是该名称与 ~ 连接而成。我注意到,当名称以表情符号结尾时,查询中不会返回带有表情符号的名称。是否可以像 Firestore 中那样在使用 Firebase 实时数据库时对表情符号执行查询?

Database.database()
    .reference(withPath: "TagIDs")
    .queryOrdered(byChild: "name")
    .queryStarting(atValue: startValue)
    .queryEnding(atValue: endValue)
    .observeSingleEvent(of: .value, with: { (snapshot) in
    …

Input name = “home”

expected output = “home”

actual output: The snapshot is empty

根据您的描述,您似乎在搜索:

Database.database()
    .reference(withPath: "TagIDs")
    .queryOrdered(byChild: "name")
    .queryStarting(atValue: "home")
    .queryEnding(atValue: "home~")

然后期望得到 "home" 作为结果。但是 </code> 实际上在 Unicode 规范中 <code>~ 之后,所以您的查询在 </code>.</p> 之前结束 <p>要获取以 <code>"home" 开头的完整范围的 TagIDs 值,请在 "home\uf8ff" 处结束查询,\u{f8ff} 是 Unicode 中最后一个代码点的转义符.