Charles Strahan
2011-Apr-09 03:42 UTC
[Ironruby-core] Encoding::InvalidByteSequenceError: character U+7453 can''t be encoded in IBM437
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-source.html#l00078> *, 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 -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://rubyforge.org/pipermail/ironruby-core/attachments/20110408/a06b609d/attachment.html>
Charles Strahan
2011-Apr-10 00:18 UTC
[Ironruby-core] Encoding::InvalidByteSequenceError: character U+7453 can''t be encoded in IBM437
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 < charles.c.strahan at gmail.com> wrote:> 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-source.html#l00078> > *, 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 >-------------- next part -------------- An HTML attachment was scrubbed... URL: <http://rubyforge.org/pipermail/ironruby-core/attachments/20110409/24510d0a/attachment-0001.html>
Charles Strahan
2011-Apr-10 05:28 UTC
[Ironruby-core] Encoding::InvalidByteSequenceError: character U+7453 can''t be encoded in IBM437
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 at gmail.com> wrote:> 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 < > charles.c.strahan at gmail.com> wrote: > >> 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-source.html#l00078> >> *, 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 >> > >-------------- next part -------------- An HTML attachment was scrubbed... URL: <http://rubyforge.org/pipermail/ironruby-core/attachments/20110410/7322b78e/attachment.html>