Use PrintableString in oatdump.

And enhance PrintableString to assume modified UTF-8, which is all we ever give
it. \u0000 is more readable than \xc0\x80 to most people.

Change-Id: I45bd8d65694eda0ef4ef03abc40f41a76f07a671
diff --git a/src/utils.h b/src/utils.h
index 4bfd885..c709f9a 100644
--- a/src/utils.h
+++ b/src/utils.h
@@ -148,22 +148,9 @@
   return result;
 }
 
-// TODO: assume the content is UTF-8, and show code point escapes?
-template<typename StringT>
-static inline std::string PrintableString(const StringT& s) {
-  std::string result;
-  result += '"';
-  for (typename StringT::const_iterator it = s.begin(); it != s.end(); ++it) {
-    char ch = *it;
-    if (NeedsEscaping(ch)) {
-      StringAppendF(&result, "\\x%02x", ch & 0xff);
-    } else {
-      result += ch;
-    }
-  }
-  result += '"';
-  return result;
-}
+// Returns an ASCII string corresponding to the given UTF-8 string.
+// Java escapes are used for non-ASCII characters.
+std::string PrintableString(const std::string& utf8);
 
 // Tests whether 's' starts with 'prefix'.
 bool StartsWith(const std::string& s, const char* prefix);