JRuby

Implement Iconv instance methods iconv, close

Details

  • Type: Bug Bug
  • Status: Closed Closed
  • Priority: Major Major
  • Resolution: Fixed
  • Affects Version/s: JRuby 0.9.1
  • Fix Version/s: JRuby 1.0.0RC2
  • Component/s: Extensions
  • Labels:
    None
  • Number of attachments :
    0

Description

The class methods of Iconv exist, but the instance methods do not. The instance methods are a little more complex because they need to allow partial character calls and then use the left over bytes with the next call. CharsetDecoder and CharsetEncoder is capable of this.

Activity

Hide
Joao Pedrosa added a comment -

BTW, the "json" library depends on the "iconv" instance method:

[...]
UTF16toUTF8 = Iconv.new('utf-8', 'utf-16be')

  1. An iconv instance to convert from UTF16 Big Endian to UTF8.
    UTF8toUTF16 = Iconv.new('utf-16be', 'utf-8'); UTF8toUTF16.iconv('no bom')
    rescue Errno::EINVAL
    begin
    old_verbose = $VERBOSE
    $VERBOSE = nil
  2. An iconv instance to convert from UTF8 to UTF16 Big Endian.
    UTF16toUTF8 = Iconv.new('utf-8', 'utf-16')
  3. An iconv instance to convert from UTF16 Big Endian to UTF8.
    UTF8toUTF16 = Iconv.new('utf-16', 'utf-8'); UTF8toUTF16.iconv('no bom')
    if UTF8toUTF16.iconv("\xe2\x82\xac") == "\xac\x20"
    [...]
Show
Joao Pedrosa added a comment - BTW, the "json" library depends on the "iconv" instance method: [...] UTF16toUTF8 = Iconv.new('utf-8', 'utf-16be')
  1. An iconv instance to convert from UTF16 Big Endian to UTF8. UTF8toUTF16 = Iconv.new('utf-16be', 'utf-8'); UTF8toUTF16.iconv('no bom') rescue Errno::EINVAL begin old_verbose = $VERBOSE $VERBOSE = nil
  2. An iconv instance to convert from UTF8 to UTF16 Big Endian. UTF16toUTF8 = Iconv.new('utf-8', 'utf-16')
  3. An iconv instance to convert from UTF16 Big Endian to UTF8. UTF8toUTF16 = Iconv.new('utf-16', 'utf-8'); UTF8toUTF16.iconv('no bom') if UTF8toUTF16.iconv("\xe2\x82\xac") == "\xac\x20" [...]
Hide
Charles Oliver Nutter added a comment -

Tom sounded like he might be able to fix this soon, so here's hoping!

Show
Charles Oliver Nutter added a comment - Tom sounded like he might be able to fix this soon, so here's hoping!
Hide
Thomas E Enebo added a comment -

Fixed in commit 3642 (patch by Koichiro Ohba)

Show
Thomas E Enebo added a comment - Fixed in commit 3642 (patch by Koichiro Ohba)

People

Vote (0)
Watch (1)

Dates

  • Created:
    Updated:
    Resolved: