Issue Details (XML | Word | Printable)

Key: JRUBY-310
Type: Bug Bug
Status: Closed Closed
Resolution: Fixed
Priority: Major Major
Assignee: Thomas E Enebo
Reporter: Thomas E Enebo
Votes: 0
Watchers: 1
Operations

If you were logged in you would be able to see more operations.
JRuby

Implement Iconv instance methods iconv, close

Created: 28/Nov/06 05:36 PM   Updated: 22/May/07 05:51 PM
Component/s: Extensions
Affects Version/s: JRuby 0.9.1
Fix Version/s: JRuby 1.0.0RC2

Time Tracking:
Not Specified


 Description  « Hide
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.

 All   Comments   Work Log   Change History      Sort Order: Ascending order - Click to sort in descending order
Joao Pedrosa added a comment - 27/Jan/07 09:41 AM
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"
    [...]

Charles Oliver Nutter added a comment - 18/Apr/07 04:10 AM
Tom sounded like he might be able to fix this soon, so here's hoping!

Thomas E Enebo added a comment - 09/May/07 09:31 PM
Fixed in commit 3642 (patch by Koichiro Ohba)