Issue Type: Bug Bug
Affects Versions: JRuby 1.6.7, JRuby 1.6.4
Assignee: Unassigned
Components: Encoding, Java Integration, Standard Library
Created: 23/Aug/12 1:44 PM
Description:

String#slice on strings with multibyte characters raises Java::JavaLang::ArrayIndexOutOfBoundsException for certain parameters.

> 'Ã¥'.encoding.to_s
=> "UTF-8"

> 'Ã¥'.slice(0,16)
=> "Ã¥", whereas

> 'Ã¥'.slice(0,17)
=> Java::JavaLang::ArrayIndexOutOfBoundsException

Moreover,

> '1234567890Ã¥'.slice(0,17)
=> "1234567890Ã¥"

> '1234567890Ã¥'.slice(1,17)
=> "234567890Ã¥\x00\x00\x00\x00"

> '1234567890Ã¥'.slice(9,17)
=> Java::JavaLang::ArrayIndexOutOfBoundsException

The examples above works in MRI Ruby 1.9.3.

Environment: Mac OS X 10.7.4
Project: JRuby
Priority: Major Major
Reporter: Joel Karlsson
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators.
For more information on JIRA, see: http://www.atlassian.com/software/jira
--------------------------------------------------------------------- To unsubscribe from this list, please visit: http://xircles.codehaus.org/manage_email

Reply via email to