Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

Encoding problem with string format #1511

Closed
retoo opened this Issue · 3 comments

4 participants

@retoo

String#% (string formatting) converts to wrong encoding when a %s is supplied with an integer.

x = "%s ä"
puts x.encoding
puts (x % 2).encoding

prints

UTF-8
US-ASCII
@retoo

Workaround:

x = "%s ä"
puts (x % "" + 2.to_s).encoding
@headius
Owner

Just to confirm, the PR referenced was never merged, right?

@lucasallan
Collaborator

No, I got a few specs failing when ran it on Travis.

@headius headius closed this issue from a commit
@headius headius Fix #1511 by choosing original encoding appropriately.
The new logic here chooses the original (format) string's encoding
when appending a US-ASCII string if the format string contains
non-ASCII characters or its encoding is not ASCII compatible.
bbf8e8f
@headius headius closed this in bbf8e8f
@enebo enebo added this to the JRuby 1.7.11 milestone
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.