: Re: [Ironruby-core] byte[] to ruby string
<"This is a test\n"> expected but was
<"This is a test\r\n">.
windows default is to use CRLF for a new line and the CLR inherits that
But for ruby the new line constant is a LF which ruby inherits from *nix based
systems
<"This is a test\n"> expected but was
<"This is a test\r\n">.
windows default is to use CRLF for a new line and the CLR inherits that
But for ruby the new line constant is a LF which ruby inherits from *nix
based systems
the dirty workaround is
either specify data0 = "This is a test\r\n"
or
data1
Thanks,
CreateBinary made the picture file pass the test.
I'm having some trouble with some plain text and newlines. Any idea why
"test_3" don't pass?
require 'test/unit'
include System::IO
class Binstring < Test::Unit::TestCase
def test_1
fileName = 'flowers.jpg'
#Ruby
data1 =
quot;hello"
Tomas
-Original Message-
From: [email protected]
[mailto:[email protected]] On Behalf Of Håkon Clausen
Sent: Thursday, October 22, 2009 2:13 PM
To: [email protected]
Subject: [Ironruby-core] byte[] to ruby string
Hello,
I
> String.CreateBinary().Append(a, 3, 3)
=> "\000A\000"
Tomas
From: [email protected]
[mailto:[email protected]] On Behalf Of Ivan Porto Carrero
Sent: Thursday, October 22, 2009 4:14 PM
To: [email protected]
Subject: Re: [Ironruby-core] byte[]
om :0:in `catch'
>from c:/IronRuby/bin/iirb:13
>from :0:in `catch'
> irb(main):002:0>
>
>
>
>
> -Original Message-
> From: [email protected] [mailto:
> [email protected]] On Behalf Of Håkon Clausen
> Sent:
[email protected]
[mailto:[email protected]] On Behalf Of Håkon Clausen
Sent: Thursday, October 22, 2009 2:13 PM
To: [email protected]
Subject: [Ironruby-core] byte[] to ruby string
Hello,
I'm struggling with converting a byte array into a r
File.open(filename, 'rb:BINARY) { |f| f.read } might help not sure though.
You can also look into the unpack method of a string that is used for
returning a bunch of different serialization formats.
http://www.ruby-doc.org/core/classes/String.html#M000760
---
Met vriendelijke groeten - Best regar
Hello,
I'm struggling with converting a byte array into a ruby binary string.
Does anybody know how to make something like this pass?
require 'test/unit'
include System::IO
class Binstring < Test::Unit::TestCase
def test_binstring_bytea
fileName = 'flowers.jpg'
#Ruby way
data1 =