Project

General

Profile

Actions

Bug #18958

closed

Kernel#sprintf doesn't apply format sequence in some encodings

Added by andrykonchin (Andrew Konchin) over 2 years ago. Updated over 2 years ago.

Status:
Closed
Assignee:
-
Target version:
-
[ruby-core:109431]

Description

I've noticed that sprintf does nothing (at least for %f) when format string is in the following encodings:

  • UTF-16
  • UTF-16BE
  • UTF-16LE
  • UTF-32
  • UTF-32BE
  • UTF-32LE
  • UCS-2BE
  • UCS-4BE
  • UCS-4LE
  • IBM037
  • ebcdic-cp-us

Example:

format = "%10.4f".encode("UTF-32")
sprintf(format, 12.34)
# => "\uFEFF%10.4f"

Updated by matz (Yukihiro Matsumoto) over 2 years ago

I agree with raising exception when the format string is not ASCII compatible.

Matz.

Updated by mame (Yusuke Endoh) over 2 years ago

@naruse (Yui NARUSE), @nobu (Nobuyoshi Nakada), and @matz (Yukihiro Matsumoto) agreed that it should raise an exception if the format string is not ASCII-compatible.

Actions #3

Updated by nobu (Nobuyoshi Nakada) over 2 years ago

  • Status changed from Open to Closed

Applied in changeset git|1a2f99275be28fb0e8ff4cfc0165966e99898d70.


[Bug #18958] format string must be ASCII compatible

Actions

Also available in: Atom PDF

Like0
Like0Like0Like0