From: Woody Peterson Date: 2010-07-30T11:08:00+09:00 Subject: binary encode 7 ([7].pack("C")) as "\007" instead of "\a" I have a problem that's on the borders of ruby and erlang, but I'm beginning to think the solution won't be from the erlang side of things. (and forgive me for my haziness with the terminology here...) The basic problem is that ruby encodes the integer 7 as "\a", while erlang only decodes it as "\007". Ruby *will* decode both "\007" and "\a" into 7, which makes me think there's more than one opinion about how it can be encoded, and that ruby might be able to encode it as "\007" if I knew how to ask it. The bigger problem is I'm trying to send data from ruby to erlang via BERT, and turns out it can't handle data (broadly defined) of length 7 (!). Here's some code examples: ruby: [7].pack("C") # => "\a" "\a".unpack("C") # => 7 "\007".unpack("C") # => 7 erlang: <<"\a">>. % => <> <<"\007">>. % => <<7>> Not sure exactly what to google here, "erlang OR ruby binary 007" doesn't really get me anywhere (suprise!), plus I'm not sure what exactly this encoding/decoding specification is called. I'd really like to understand why the design discrepancy between the languages, but I'd settle for a quick fix on the ruby side :) Any help is appreciated, -Woody (PS, more details are at http://github.com/mojombo/bert.erl/issues#issue/3, although examples are bert-specific) -- Posted via http://www.ruby-forum.com/.