# %x and mswin32: missing output (from binary character)

**URL:** <https://www.ruby-forum.com/t/x-and-mswin32-missing-output-from-binary-character/56036>\
**Category:** Ruby\
**Created:** [March 27, 2006, 2:19pm UTC](https://www.ruby-forum.com/t/x-and-mswin32-missing-output-from-binary-character/56036 "2006-03-27T14:19:59Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Jerome\_Zago](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/3ec8ea/32.png) [@Jerome\_Zago](https://www.ruby-forum.com/u/Jerome_Zago)\
**Post date:** [March 27, 2006, 2:19pm UTC](https://www.ruby-forum.com/t/x-and-mswin32-missing-output-from-binary-character/56036/1 "2006-03-27T14:19:59Z")

</div>

$ cat write.rb  
puts “ab\032cd”

$ cat execute.rb  
print %x{ruby write.rb}

$ ruby execute.rb  
ab  
[I expected “ab&#8594;cd”]

$ ruby --version # I could reproduce with:  
ruby 1.8.4 (2005-12-24) [i386-mswin32]  
ruby 1.8.4 (2006-03-23) [i386-mswin32]  
ruby 1.9.0 (2006-03-23) [i386-mswin32]

In comparison:

$ cat write.pl  
print “ab\032cd\n”

$ cat execute.pl  
print qx{perl write.pl};

$ perl execute.pl  
ab→cd

$ perl --version  
This is perl, v5.8.8 built for MSWin32-x86-multi-thread

* * *

The following patch (against HEAD) solves this problem but might have  
unwanted  
side-effects:

— io.c.orig 2006-03-01 11:06:03.000000000 +0100  
+++ io.c 2006-03-24 19:22:19.885940500 +0100  
@@ -4380,15 +4380,15 @@  
rb\_f\_backquote(VALUE obj, VALUE str)  
{  
volatile VALUE port;  
VALUE result;  
OpenFile \*fptr;

```
 SafeStringValue(str);

```

- port = pipe\_open(1, &str, “r”);

- port = pipe\_open(1, &str, “rb”);  
if (NIL\_P(port)) return rb\_str\_new(0,0);
