From 3cb9c15995b828c52dba34d0a222f572d5bbc41b Mon Sep 17 00:00:00 2001 From: Bernard Normier Date: Thu, 20 Oct 2016 21:03:44 -0400 Subject: Added support for non-ASCII characters and universal character names to stringified identities and proxies. This includes a new Ice.ToStringMode property. --- cpp/src/Ice/Reference.cpp | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) (limited to 'cpp/src/Ice/Reference.cpp') diff --git a/cpp/src/Ice/Reference.cpp b/cpp/src/Ice/Reference.cpp index 86328e0880a..12296b9f04f 100644 --- a/cpp/src/Ice/Reference.cpp +++ b/cpp/src/Ice/Reference.cpp @@ -28,8 +28,8 @@ #include #include #include +#include -#include #include #include @@ -231,13 +231,18 @@ IceInternal::Reference::toString() const // ostringstream s; + ToStringMode toStringMode = _instance->toStringMode(); + const string separators = " :@"; + + string id = Ice::identityToString(_identity, toStringMode); + // // If the encoded identity string contains characters which // the reference parser uses as separators, then we enclose // the identity string in quotes. // - string id = Ice::identityToString(_identity); - if(id.find_first_of(" :@") != string::npos) + + if(id.find_first_of(separators) != string::npos) { s << '"' << id << '"'; } @@ -250,14 +255,13 @@ IceInternal::Reference::toString() const { s << " -f "; + string fs = escapeString(fs, "", toStringMode); // // If the encoded facet string contains characters which // the reference parser uses as separators, then we enclose // the facet string in quotes. // - string fs = nativeToUTF8(_facet, _instance->getStringConverter()); - fs = IceUtilInternal::escapeString(fs, ""); - if(fs.find_first_of(" :@") != string::npos) + if(fs.find_first_of(separators) != string::npos) { s << '"' << fs << '"'; } @@ -1224,8 +1228,7 @@ IceInternal::RoutableReference::toString() const // reference parser uses as separators, then we enclose the // adapter id string in quotes. // - string a = nativeToUTF8(_adapterId, getInstance()->getStringConverter()); - a = IceUtilInternal::escapeString(a, ""); + string a = escapeString(_adapterId, "", getInstance()->toStringMode()); if(a.find_first_of(" :@") != string::npos) { result.append("\""); -- cgit v1.2.3