summaryrefslogtreecommitdiff
path: root/sprintf.c
diff options
context:
space:
mode:
authorusa <usa@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2014-09-03 03:27:43 +0000
committerusa <usa@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2014-09-03 03:27:43 +0000
commitd910ce1f908a70afad5261d91fd6dec0a3708240 (patch)
tree72ac3ecb727d68441d804e30fb310a71edf8b16b /sprintf.c
parentb10c3b6d51d7fb0597670d88a537d713b445098e (diff)
merge revision(s) 42251,46345,46346: [Backport #9903]
* sprintf.c (ruby__sfvextra): add QUOTE flag to escape unprintable characters. * sprintf.c (ruby__sfvextra): add QUOTE flag to escape unprintable characters. * re.c (match_aref, rb_reg_regsub): consider encoding of captured names, encoding-incompatible should not match. [ruby-dev:48278] [Bug #9903] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_2_0_0@47364 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'sprintf.c')
-rw-r--r--sprintf.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/sprintf.c b/sprintf.c
index 9443c69925..18e745593d 100644
--- a/sprintf.c
+++ b/sprintf.c
@@ -14,6 +14,7 @@
#include "ruby/ruby.h"
#include "ruby/re.h"
#include "ruby/encoding.h"
+#include "internal.h"
#include <math.h>
#include <stdarg.h>
@@ -1195,6 +1196,7 @@ ruby__sfvextra(rb_printf_buffer *fp, size_t valsize, void *valp, long *sz, int s
}
else {
value = rb_obj_as_string(value);
+ if (sign == ' ') value = QUOTE(value);
}
enc = rb_enc_compatible(result, value);
if (enc) {