blob: a53c3b6de58753c23761eec1a4bb58df41d363e8 [file] [log] [blame]
// Copyright 2015 The Vanadium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
part of syncbase_client;
// escape escapes a component name for use in a Syncbase object name. In
// particular, it replaces bytes "%" and "/" with the "%" character followed by
// the byte's two-digit hex code. Clients using the client library need not
// escape names themselves; the client library does so on their behalf.
String escape(String s) {
return naming.encodeAsNameElement(s);
}
// unescape applies the inverse of escape. Throws exception if the given string
// is not a valid escaped string.
String unescape(String s) {
return naming.decodeFromNameElement(s);
}