This project is archived and is in readonly mode.
ActionPack, 1.9.2-head 3 failing tests regarding encodings
Reported by Rohit Arondekar | May 26th, 2010 @ 07:19 AM | in 3.0.2
Rails Master ActionPack, ruby 1.9.2dev (2010-05-08 trunk 27665) [x86_64-linux] has 3 failing tests.
The stacktrace is as follows:
1) Failure: (TextHelperTest)
[test/template/text_helper_test.rb:221]: <"...\x83ciency could
not be..."> expected but was
<"...fficiency could not be...">.
2) Failure: test_truncate_multibyte(TextHelperTest)
[test/template/text_helper_test.rb:87]:
<"\xEC\x95\x88\xEB\x85\x95\xED..."> expected but was
<"안녕하세요">.
3) Failure:
test_scoping_by_partial_of_an_array(TranslationHelperTest)
[test/template/translation_helper_test.rb:41]:
<"foobar"> expected but was
<"["foo", "bar"]">.
2704 tests, 11359 assertions, 3 failures, 0 errors, 0
skips
Note: It's best to run the tests yourself, because I don't think some of the chars got copied from my terminal properly.
Regarding the first 2 failures, it happens when force_encoding is not used.
The failing assert is as follows:
assert_equal("...\203ciency could not be...", excerpt("That's why
e\357\254\203ciency could not be helped", 'could', 8))
Note that:
"...\203ciency could not be...".encoding => ASCII-8BIT
excerpt("That's why e\357\254\203ciency could not be helped",
'could', 8).encoding => UTF-8
Similarly the 2nd test. I'm looking into the 3rd test now.
Comments and changes to this ticket
-
Rohit Arondekar May 26th, 2010 @ 07:31 AM
The 3rd failure seems like a mistake in the return value of t. I've attached a patch to fix this (if it's indeed the problem).
-
Rohit Arondekar May 26th, 2010 @ 04:32 PM
Bad formatting in the original message.
This is regarding the first 2 tests, asserts without force_encoding:
The string literals have encoding of ASCII-8BIT
"...\203ciency could not be...".encoding => ASCII-8BITWhereas, excerpt returns a UTF-8 string, and hence the tests fail.
excerpt("That's why e\357\254\203ciency could not be helped", 'could', 8).encoding => UTF-8 -
Santiago Pastorino May 26th, 2010 @ 04:56 PM
- Milestone cleared.
- State changed from new to open
That's not the proper fix Rohit.
This test is fixed here. -
Rohit Arondekar May 27th, 2010 @ 03:12 AM
Santiago, thanks for the proper fix. I've never used translation so I didn't know what t() is supposed to return. Any idea how to fix the first 2 failures?
-
Rohit Arondekar May 27th, 2010 @ 03:32 AM
+1 on the patch, the translation test now passes on 1.8.7 and 1.9.2-head.
-
Repository May 29th, 2010 @ 08:21 PM
(from [e5a56eb297f41dae12e03cf03bad4a25068bba09]) fix translation test in actionpack [#4701 state:commited]
Signed-off-by: wycats wycats@gmail.com
http://github.com/rails/rails/commit/e5a56eb297f41dae12e03cf03bad4a... -
Rohit Arondekar May 30th, 2010 @ 06:20 AM
I think it would be a good idea to mark this ticket resolved as the tests now pass after commit => http://github.com/rails/rails/commit/d7f6f2b596d00a7deb4f83592aaa78...
But from the comment in the commit, ".mb_chars always returns UTF-8, even in 1.9. This is not great, but it's how it works. Let's work this out." (http://bit.ly/aUsn1o), a new dedicated ticket can be opened?
-
Santiago Pastorino May 30th, 2010 @ 06:27 AM
- State changed from open to committed
[#OMG state:committed] with one t. So i'm closing by hand
-
Jeremy Kemper October 15th, 2010 @ 11:01 PM
- Milestone set to 3.0.2
- Importance changed from to Low
Create your profile
Help contribute to this project by taking a few moments to create your personal profile. Create your profile »
<h2 style="font-size: 14px">Tickets have moved to Github</h2>
The new ticket tracker is available at <a href="https://github.com/rails/rails/issues">https://github.com/rails/rails/issues</a>
People watching this ticket
Attachments
Referenced by
- 4701 ActionPack, 1.9.2-head 3 failing tests regarding encodings (from [e5a56eb297f41dae12e03cf03bad4a25068bba09]) fix tra...