You could also base64 encode the document ID for use as the channel. On Jan 16, 2015 4:24 AM, <[email protected]> wrote:
> [email protected] > <https://groups.google.com/forum/?utm_source=digest&utm_medium=email#!forum/mobile-couchbase/topics> > Google > Groups > <https://groups.google.com/forum/?utm_source=digest&utm_medium=email/#!overview> > <https://groups.google.com/forum/?utm_source=digest&utm_medium=email/#!overview> > Topic digest > View all topics > <https://groups.google.com/forum/?utm_source=digest&utm_medium=email#!forum/mobile-couchbase/topics> > > - Legal Characters for Document ID <#14af2b38492d6f8d_group_thread_0> > - 1 Update > > Legal Characters for Document ID > <http://groups.google.com/group/mobile-couchbase/t/b61a3a925b2f680?utm_source=digest&utm_medium=email> > Jens Alfke <[email protected]>: Jan 15 08:30AM -0800 > > > On Jan 15, 2015, at 3:11 AM, Andrew Tokarev <[email protected]> > wrote: > > > I recently found out that custom doc_id is not validated on iOS/Android > (might be true for other platforms). > > So it is possible to pass something like: "£%&-7", which causes > exception on SyncGateway (no crash). > > That is a valid document ID. > > > 15:19:44.729250 CRUD+: Invoking sync on doc "£%&-7" rev > 2-d36047fd7682b8f3255a0652ba510790 > > 15:19:44.729562 CRUD+: No old revision "£%&-7" / > "1-691feb51f7ea0da0c8e56132396a0451" > > 15:19:44.729856 WARNING: Sync fn exception: 400 Illegal channel name > "person-£%&-7"; doc = map[_id:£%&-7 type:Person > _revisions:map[start:%!s(float64=2) ids:[d36047fd7682b8f3255a0652ba510790 > 691feb51f7ea0da0c8e56132396a0451]] _rev:2-d36047fd7682b8f3255a0652ba510790] > -- db.(*Database).getChannelsAndAccess() at crud.go:686 > > …but that same string is an illegal channel ID. Doc and channel IDs are > not the same thing. It can be convenient to name a channel after a > document, but if you do that you need to ensure [on the client] that the > document is given an ID that's a valid channel ID. Or your sync function > could escape characters in the doc ID to make it a valid channel ID. > > —Jens > Back to top <#14af2b38492d6f8d_digest_top> > You received this digest because you're subscribed to updates for this > group. You can change your settings on the group membership page > <https://groups.google.com/forum/?utm_source=digest&utm_medium=email#!forum/mobile-couchbase/join> > . > To unsubscribe from this group and stop receiving emails from it send an > email to [email protected]. > -- You received this message because you are subscribed to the Google Groups "Couchbase Mobile" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/mobile-couchbase/CA%2Bh6LvrmRXJ6pOuAt06mRpmO-04qQZgMvaZvQhgGwAC9Ey93Gw%40mail.gmail.com. For more options, visit https://groups.google.com/d/optout.
