Hello, I'm getting the following error while running one of the examples (Enumerate Top Level Windows <https://github.com/ffi/ffi/wiki/Windows-Examples>) from the FFI wiki: *Encoding::InvalidByteSequenceError: character U+7453 can't be encoded in IBM437* * from (irb):26:in `puts'* The example works fine in MRI 1.9.2, so I'm curious if this might be a bug, or if I'm screwing something up in my FFI impl. Official FFI uses *str_new<http://www.ruby-doc.org/doxygen/1.8.4/string_8c-so... *, which in turn performs a simple *memcopy* given a *char**, which is more or less what I'm doing to construct my string... At any rate, the example, which features callbacks, makes it this far (which is exciting): *[001] Found ''* *[002] Found ''* *[003] Found ''* *[004] Found ''* *[005] Found ''* *[006] Found ''* *[007] Found ''* *[008] Found ''* *Encoding::InvalidByteSequenceError: character U+7453 can't be encoded in IBM437* * from (irb):26:in `puts'* -Charles
on 2011-04-09 05:45
on 2011-04-10 02:19
On second thought (and with a little more rest), I'm pretty positive this my problem :). -Charles On Fri, Apr 8, 2011 at 10:42 PM, Charles Strahan <
on 2011-04-10 07:50
Nope - must be a bug in IronRuby:
*MRI v1.9.2:*
*
irb(main):001:0> str = "%s" % "\u00c2"
=> "\u00C2"
irb(main):002:0> str.encoding
=> #<Encoding:UTF-8>
irb(main):003:0> puts str
Â
*
*IronRuby v1.1.3:*
*
irb(main):001:0> str = "%s" % "\u00c2"
=> "\xC2"
irb(main):002:0> str.encoding
=> #<Encoding:IBM437>
irb(main):003:0> puts str
Encoding::InvalidByteSequenceError: character U+00C2 can't be encoded in
IBM437
from (irb):3:in `puts'
from (irb):3
from C:/IronRuby/bin/irb:13
*
*String#%* seems to handle encoding differently between the two Rubies.
If
I can figure it out, I'll send a pull request.
Cheers,
-Charles
On Sat, Apr 9, 2011 at 7:18 PM, Charles Strahan
<charles.c.strahan@gmail.com
Please log in before posting. Registration is free and takes only a minute.
Existing account
(Switch to SSL-encrypted connection)
NEW: Do you have a Google/GoogleMail or Yahoo account? No registration required!
Log in with Google account | Log in with Yahoo account
Log in with Google account | Log in with Yahoo account
No account? Register here.