History | Log In     View a printable version of the current page.  
Issue Details (XML | Word | Printable)

Key: JRUBY-1246
Type: Improvement Improvement
Status: Closed Closed
Resolution: Fixed
Priority: Trivial Trivial
Assignee: Ola Bini
Reporter: kennyj
Votes: 0
Watchers: 1
Operations

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

Base64Coder#encode(String) has a problem.

Created: 28/Jul/07 02:36 AM   Updated: 22/Dec/07 06:26 AM
Component/s: Core Classes/Modules
Affects Version/s: JRuby 1.0.0
Fix Version/s: JRuby 1.1b1, JRuby 1.0.2, JRuby 1.0.3

Time Tracking:
Not Specified

File Attachments: 1. Java Source File Base64CoderTest.java (0.8 kb)
2. Text File patch.txt (1 kb)

Environment:
windows vista business
jdk1.5.0_12
jruby 1.0.0

Testcase included: yes


 Description  « Hide
・Base64Coder#encode(String) use "String#getBytes()"
・affected from environment (ex. my japanese env)
・Base64Coder#encode(String) is not used (from other java source code).

therefore, i think

・parameter encoding can be specified. [with patch]

or

・remove Base64Coder#encode(String)

thanks

kennyj



 All   Comments   Work Log   Change History      Sort Order: Ascending order - Click to sort in descending order
Charles Oliver Nutter - 21/Oct/07 09:36 PM
Are you providing this patch simply because you want to use Base64Coder? I believe it may be used in other libraries, perhaps we could just add the method you are looking for?

kennyj - 21/Oct/07 10:51 PM
#sorry, my poor english

No. Because,

・String#getBytes() is affected by environment(because this method use "default encoding")
・I looked for "where call String#getBytes()", when i had file upload problem (JRUBY-1206)

  1. i think we should not use String#getBytes()
    ・Base64Coder used String#getBytes()
    ・No one used it. (in commited sources)
     sorry, It was not thought. "not commited sources"

Ola Bini - 30/Oct/07 06:49 PM
It's more correct to always do getBytes("ISO-8859-1") in this case. The fix has been committed.