Bug#676114: Ruby help needed (Was: Bug#676114: wordnet: FTBFS: debian/wn-for-goldendict.rb:465: invalid multibyte char (US-ASCII))

Antonio Terceiro terceiro at debian.org
Wed Jun 6 00:37:32 UTC 2012


Hi,

Per Andersson escreveu isso aí:
> Please see the attached patch and try if it works.

Heh, except that you missed other usages of the same pattern. Andreas,
please try the attached patch.

As Per explained, the problem is that in Ruby 1.8, a string is an array
of bytes, so str[0] returns a number (the byte at position 0).  Ruby 1.9
is fully encoding-aware, so a string is an array of characters and
str[0] returns a string that is the first *character* in str.

What I did was replacing the occurrences of str[0] with str.bytes.first
to explicitly request the first *byte* in str.

The resulting output when run with Ruby 1.9 is pretty much the same as
the original version generates when run by Ruby 1.8, *except* for the
ordering between lowercase and lowercase letters. Maybe that is due to
some other detail, but understanding that script completely is too much
for me. :)

If that's not acceptable, you can also (at least for Wheezy) run the
script from debian/rules with `ruby1.8` instead of `ruby` and build
depend on ruby1.8 explicitly.

-- 
Antonio Terceiro <terceiro at debian.org>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: wordnet-dict-conversion.patch
Type: text/x-diff
Size: 1465 bytes
Desc: not available
URL: <http://lists.alioth.debian.org/pipermail/debian-science-maintainers/attachments/20120605/4740a607/attachment-0001.patch>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 198 bytes
Desc: Digital signature
URL: <http://lists.alioth.debian.org/pipermail/debian-science-maintainers/attachments/20120605/4740a607/attachment-0001.pgp>


More information about the debian-science-maintainers mailing list