[svn:parrot] r49252 - trunk/src/pmc

NotFound at svn.parrot.org NotFound at svn.parrot.org
Wed Sep 22 23:22:36 UTC 2010


Author: NotFound
Date: Wed Sep 22 23:22:35 2010
New Revision: 49252
URL: https://trac.parrot.org/parrot/changeset/49252

Log:
use the FileHandle encoding in readline_interactive

Modified:
   trunk/src/pmc/filehandle.pmc

Modified: trunk/src/pmc/filehandle.pmc
==============================================================================
--- trunk/src/pmc/filehandle.pmc	Wed Sep 22 22:26:42 2010	(r49251)
+++ trunk/src/pmc/filehandle.pmc	Wed Sep 22 23:22:35 2010	(r49252)
@@ -379,11 +379,20 @@
         Parrot_str_free_cstring(prompt_cstring);
 
         if (r) {
+            STRING *encoding;
+            const STR_VTABLE *enc = NULL;
+            GET_ATTR_encoding(INTERP, SELF, encoding);
             if (*r)
                 add_history(r);
-
-            string_result = Parrot_str_new(INTERP, r, 0);
+            if (!STRING_IS_NULL(encoding))
+                enc = Parrot_get_encoding(INTERP, Parrot_encoding_number(INTERP, encoding));
+            if (enc == NULL)
+                string_result = Parrot_str_new(INTERP, r, 0);
+            else
+                string_result = Parrot_str_new_init(INTERP, r, strlen(r), enc, 0);
             free(r);
+            if (enc != NULL)
+                STRING_validate(INTERP, string_result);
         }
 #else
         if (got_prompt) {


More information about the parrot-commits mailing list