fix encoding error in Polish locale on Windows [1-x] #1065

Merged
merged 1 commit into from Jun 28, 2013

Conversation

Projects
None yet
2 participants
@katafrakt
Contributor

katafrakt commented Jun 27, 2013

In Polish (perhaps in other locales too) result of Time.now.strftime("%Y/%m/%d %H:%M:%S %Z") contains national characters on Windows, which is out of scope of default US-ASCII encoding. This results in an error thrown when trying to log failure using default Redis backend: *** Received exception when reporting failure: #<Encoding::InvalidByteSequenceError: "\x8C" on US-ASCII> and no information about the failure is saved.

When string with timezone name is cleaned, everything works as expected.

irb(main):011:0> Time.now.strftime("%Y/%m/%d %H:%M:%S %Z")
"2013/06/27 18:19:18 \x8Crodkowoeuropejski czas letni"

steveklabnik added a commit that referenced this pull request Jun 28, 2013

Merge pull request #1065 from katafrakt/utf8_in_redis_failure_fix
fix encoding error in Polish locale on Windows [1-x]

@steveklabnik steveklabnik merged commit 14cdaf4 into resque:1-x-stable Jun 28, 2013

1 check failed

default The Travis CI build could not complete due to an error
Details
@steveklabnik

This comment has been minimized.

Show comment
Hide comment
@steveklabnik

steveklabnik Jun 28, 2013

Member

Thank you! This seems like a good idea.

My wifi is quite bad, so I haven't checked, but does this happen on master? Would you mind making a PR against it as well?

Member

steveklabnik commented Jun 28, 2013

Thank you! This seems like a good idea.

My wifi is quite bad, so I haven't checked, but does this happen on master? Would you mind making a PR against it as well?

@katafrakt

This comment has been minimized.

Show comment
Hide comment
@katafrakt

katafrakt Jun 28, 2013

Contributor

I does not. There is different method used on master (Time.now.rfc2822) and it's "safe" in terms of encoding.

irb(main):012:0> Time.now.rfc2822
"Fri, 28 Jun 2013 09:57:01 +0200"
Contributor

katafrakt commented Jun 28, 2013

I does not. There is different method used on master (Time.now.rfc2822) and it's "safe" in terms of encoding.

irb(main):012:0> Time.now.rfc2822
"Fri, 28 Jun 2013 09:57:01 +0200"

@katafrakt katafrakt deleted the katafrakt:utf8_in_redis_failure_fix branch Jun 28, 2013

@steveklabnik

This comment has been minimized.

Show comment
Hide comment
@steveklabnik

steveklabnik Jun 28, 2013

Member

Thank you for checking! :)

Member

steveklabnik commented Jun 28, 2013

Thank you for checking! :)

bjones pushed a commit to bjones/resque that referenced this pull request May 30, 2014

Merge pull request #1065 from katafrakt/utf8_in_redis_failure_fix
fix encoding error in Polish locale on Windows [1-x]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment