src/ccutil/unicharset.cpp
std::string UNICHARSET::debug_utf8_str(const char *str) {
  std::string result = str;
  result += " [";
  int step = 1;
  // Chop into unicodes and code each as hex.
  for (int i = 0; str[i] != '\0'; i += step) {
    char hex[sizeof(int) * 2 + 1];
    step = UNICHAR::utf8_step(str + i);
    if (step == 0) {
      step = 1;
      sprintf(hex, "%x", str[i]);
    } else {
      UNICHAR ch(str + i, step);
      sprintf(hex, "%x", ch.first_uni());
    }
    result += hex;
    result += " ";
  }
  result += "]";
  return result;
}
// Return a string that reformats the utf8 str into the str followed
// by its hex unicodes.
Return a string that reformats the utf8 str into the str followed
by its hex unicodes.
Return a string that reformats the utf8 str into the str followed by its hex unicodes .
std::string UNICHARSET::debug_utf8_str(const char *str) {
  std::string result = str;
  result += " [";
  int step = 1;
  for (int i = 0; str[i] != '\0'; i += step) {
    char hex[sizeof(int) * 2 + 1];
    step = UNICHAR::utf8_step(str + i);
    if (step == 0) {
      step = 1;
      sprintf(hex, "%x", str[i]);
    } else {
      UNICHAR ch(str + i, step);
      sprintf(hex, "%x", ch.first_uni());
    }
    result += hex;
    result += " ";
  }
  result += "]";
  return result;
}
std :: string UNICHARSET :: debug_utf8_str ( const char * str ) { std :: string result = str ; result += " " ; int step = 1 ; for ( int i = 0 ; str [ i ] != ' \0 ' ; i += step ) { char hex [ sizeof ( int ) * 2 + 1 ] ; step = UNICHAR :: utf8_step ( str + i ) ; if ( step == 0 ) { step = 1 ; sprintf ( hex , " " , str [ i ] ) ; } else { UNICHAR ch ( str + i , step ) ; sprintf ( hex , " " , ch . first_uni ( ) ) ; } result += hex ; result += " " ; } result += " " ; return result ; }
Return a string that reformats the utf8 str into the str followed
by its hex unicodes.
Return a string that reformats the utf8 str into the str followed by its hex unicodes .
// Chop into unicodes and code each as hex.