# HG changeset patch # User John W. Eaton # Date 1455826236 18000 # Node ID e0523c40a80281bd1ef48c50459180c4bd921936 # Parent 29a0e9e7087962dacb43100cf229dadfbee97e12# Parent 596e19e7e5717100c9f30a5631031043df3a82ac maint: Merge stable to default. diff -r 29a0e9e70879 -r e0523c40a802 libinterp/corefcn/oct-stream.cc --- a/libinterp/corefcn/oct-stream.cc Thu Feb 18 11:57:24 2016 -0500 +++ b/libinterp/corefcn/oct-stream.cc Thu Feb 18 15:10:36 2016 -0500 @@ -2256,7 +2256,10 @@ { if (curr_val.is_string ()) { - std::string sval = curr_val.string_value (); + dim_vector dv (1, curr_val.numel ()); + octave_value tmp = curr_val.reshape (dv); + + std::string sval = tmp.string_value (); retval = sval.substr (elt_idx); diff -r 29a0e9e70879 -r e0523c40a802 test/io.tst --- a/test/io.tst Thu Feb 18 11:57:24 2016 -0500 +++ b/test/io.tst Thu Feb 18 15:10:36 2016 -0500 @@ -673,3 +673,7 @@ %!assert (sprintf ("|%X|", "Octave"), "|4F||63||74||61||76||65|"); %!assert (sprintf ("|%o|", "Octave"), "|117||143||164||141||166||145|"); +## bug #47192 +%!assert (sprintf ("%s", repmat ("blah", 2, 1)), "bbllaahh") +%!assert (sprintf ("%c", repmat ("blah", 2, 1)), "bbllaahh") +%!assert (sprintf ("%c %c %s", repmat ("blah", 2, 1)), "b b llaahh")