-
-
Notifications
You must be signed in to change notification settings - Fork 942
Closed
Milestone
Description
puts Time.at(100).strftime('Процесс завершен за %S')
will puts garbage.
From the RubyDateFormatter code it looks like it does not set proper encoding when creating InputStreamReader and appending bytes to output.
Unable to attache the patch - copying it below:
Index: core/src/main/java/org/jruby/util/RubyDateFormatter.java
<+>UTF-8
===================================================================
--- core/src/main/java/org/jruby/util/RubyDateFormatter.java (date 1381750123000)
+++ core/src/main/java/org/jruby/util/RubyDateFormatter.java (date 1381841997000)
@@ -258,7 +258,7 @@
}
ByteArrayInputStream in = new ByteArrayInputStream(pattern.getUnsafeBytes(), pattern.getBegin(), pattern.getRealSize());
- Reader reader = new InputStreamReader(in);
+ Reader reader = new InputStreamReader(in, pattern.getEncoding().getCharset());
lexer.yyreset(reader);
Token token;
@@ -549,9 +549,7 @@
// reset formatter
formatter = RubyTimeOutputFormatter.DEFAULT_FORMATTER;
- for (int i = 0; i < output.length(); i++) {
- toAppendTo.append(output.charAt(i));
- }
+ toAppendTo.append(output.getBytes(toAppendTo.getEncoding().getCharset()));
}
RubyString str = context.runtime.newString(toAppendTo);
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels