Index: trunk/src/common.c
===================================================================
--- trunk/src/common.c	(revision 159)
+++ trunk/src/common.c	(revision 160)
@@ -145,78 +145,4 @@
 
 /*
- * Convert from UTF-16LE to ASCII.  Accepts a Unicode buffer, uni, and
- * it's length, uni_max.  Writes ASCII to the buffer ascii, whose size
- * is ascii_max.  Writes at most (ascii_max-1) bytes to ascii, and null
- * terminates the string.  Returns the length of the data written to
- * ascii.  On error, returns a negative errno code.
- */
-static int uni_to_ascii(unsigned char* uni, char* ascii, 
-			uint32 uni_max, uint32 ascii_max)
-{
-  char* inbuf = (char*)uni;
-  char* outbuf = ascii;
-  size_t in_len = (size_t)uni_max;
-  size_t out_len = (size_t)(ascii_max-1);
-  int ret;
-
-  conv_desc = iconv_open("US-ASCII//TRANSLIT", "UTF-16LE");
-
-  ret = iconv(conv_desc, &inbuf, &in_len, &outbuf, &out_len);
-  if(ret == -1)
-  {
-    iconv_close(conv_desc);
-    return -errno;
-  }
-  *outbuf = '\0';
-
-  iconv_close(conv_desc);  
-  return ascii_max-out_len-1;
-}
-
-
-static char* quote_unicode(unsigned char* uni, uint32 length, 
-			   const char* special, char** error_msg)
-{
-  char* ret_val;
-  char* ascii = NULL;
-  char* tmp_err;
-  int ret_err;
-  *error_msg = NULL;
-
-  if(length+1 > 0)
-    ascii = malloc(length+1);
-  if(ascii == NULL)
-  {
-    *error_msg = (char*)malloc(27);
-    if(*error_msg == NULL)
-      return NULL;
-    strcpy(*error_msg, "Memory allocation failure.");
-    return NULL;
-  }
-  
-  ret_err = uni_to_ascii(uni, ascii, length, length+1);
-  if(ret_err < 0)
-  {
-    free(ascii);
-    tmp_err = strerror(-ret_err);
-    *error_msg = (char*)malloc(61+strlen(tmp_err));
-    if(*error_msg == NULL)
-      return NULL;
-
-    sprintf(*error_msg, 
-	    "Unicode conversion failed with '%s'. Quoting as binary.", tmp_err);
-    ret_val = quote_buffer(uni, length, special);
-  }
-  else
-  {
-    ret_val = quote_string(ascii, special);
-    free(ascii);
-  }
-  
-  return ret_val;
-}
-
-
-/*
  * Convert a data value to a string for display.  Returns NULL on error,
  * and the string to display if there is no error, or a non-fatal
Index: trunk/src/reglookup-recover.c
===================================================================
--- trunk/src/reglookup-recover.c	(revision 159)
+++ trunk/src/reglookup-recover.c	(revision 160)
@@ -66,5 +66,5 @@
 }
 
-
+/* XXX: Somewhere in here, need to start looking for and handling classnames */
 void printKey(REGFI_FILE* f, REGFI_NK_REC* nk, const char* prefix)
 {
Index: trunk/src/reglookup.c
===================================================================
--- trunk/src/reglookup.c	(revision 159)
+++ trunk/src/reglookup.c	(revision 160)
@@ -282,5 +282,4 @@
   char* dacl = NULL;
   char* quoted_classname;
-  char* error_msg = NULL;
   char mtime[20];
   time_t tmp_time[1];
@@ -288,4 +287,5 @@
   const REGFI_SK_REC* sk;
   const REGFI_NK_REC* k = regfi_iterator_cur_key(iter);
+  REGFI_CLASSNAME* classname;
 
   *tmp_time = nt_time_to_unix(&k->mtime);
@@ -308,30 +308,29 @@
       dacl = empty_str;
 
-    if(k->classname != NULL)
-    {
-      quoted_classname = quote_unicode((uint8*)k->classname, k->classname_length,
-				       key_special_chars, &error_msg);
+    classname = regfi_iterator_fetch_classname(iter, k);
+    printMsgs(iter->f);
+    if(classname != NULL)
+    {
+      if(classname->interpreted == NULL)
+      {
+	fprintf(stderr, "WARN: Could not convert class name"
+		" charset for key '%s'.  Quoting raw...\n", full_path);
+	quoted_classname = quote_buffer(classname->raw, classname->size,
+					key_special_chars);
+      }
+      else
+	quoted_classname = quote_string(classname->interpreted, 
+					key_special_chars);
+
       if(quoted_classname == NULL)
       {
-	if(error_msg == NULL)
-	  fprintf(stderr, "ERROR: Could not quote classname"
-		  " for key '%s' due to unknown error.\n", full_path);
-	else
-	{
-	  fprintf(stderr, "ERROR: Could not quote classname"
-		  " for key '%s' due to error: %s\n", full_path, error_msg);
-	  free(error_msg);
-	}
-      }
-      else if (error_msg != NULL)
-      {
-	if(print_verbose)
-	  fprintf(stderr, "INFO: While converting classname"
-		  " for key '%s': %s.\n", full_path, error_msg);
-	free(error_msg);
+	fprintf(stderr, "ERROR: Could not quote classname"
+		" for key '%s' due to unknown error.\n", full_path);
+	quoted_classname = empty_str;
       }
     }
     else
       quoted_classname = empty_str;
+    regfi_free_classname(classname);
 
     printMsgs(iter->f);
