src/share/vm/oops/symbolOop.cpp

changeset 657
2a1a77d3458f
parent 435
a61af66fc99e
child 1573
dd57230ba8fe
     1.1 --- a/src/share/vm/oops/symbolOop.cpp	Tue Jun 24 10:43:29 2008 -0700
     1.2 +++ b/src/share/vm/oops/symbolOop.cpp	Tue Jun 24 16:00:14 2008 -0700
     1.3 @@ -68,8 +68,17 @@
     1.4  
     1.5  void symbolOopDesc::print_symbol_on(outputStream* st) {
     1.6    st = st ? st : tty;
     1.7 -  for (int index = 0; index < utf8_length(); index++)
     1.8 -    st->put((char)byte_at(index));
     1.9 +  int length = UTF8::unicode_length((const char*)bytes(), utf8_length());
    1.10 +  const char *ptr = (const char *)bytes();
    1.11 +  jchar value;
    1.12 +  for (int index = 0; index < length; index++) {
    1.13 +    ptr = UTF8::next(ptr, &value);
    1.14 +    if (value >= 32 && value < 127 || value == '\'' || value == '\\') {
    1.15 +      st->put(value);
    1.16 +    } else {
    1.17 +      st->print("\\u%04x", value);
    1.18 +    }
    1.19 +  }
    1.20  }
    1.21  
    1.22  jchar* symbolOopDesc::as_unicode(int& length) const {

mercurial