This project is archived and is in readonly mode.
"bös".chars.reverse is "s̈ob" for decomposed string
-
Henrik Nyh
The failing test isn't likely something that would be used as-is if this issue is fixed, but is rather meant to illustrate the issue.
-
Henrik Nyh
Works fine in 2.2, so problem solved.
-
Henrik Nyh
Oops, no. I forgot that the ticket was about decomposed strings, specifically, and they still fail:
>> dc = "bös".mb_chars.normalize(:kd).reverse.to_s => "s̈ob"I'm not empowered to reopen tickets, I think, but someone else please do.
-
CancelProfileIsBroken
- Tag changed from activesupport, bug, chars, multibyte, tested to activesupport, bug, bugmash, chars, multibyte, tested
- Milestone cleared.
-
Dana Jones
+1 - This is still a problem in 3.0. If you create an @string variable that equals "bös", then @string.chars.reverse has the desired result ("söb"), but @string.mb_chars.normalize(:kd).reverse.to_s outputs "s̈ob".
-
Pratik
- Assigned user set to Jeremy Kemper
-
Elad Meidar
+1 indeed verified on master, unsuccessful to reproduce with other UTF8 strings (hebrew)
-
Jeremy Kemper
- State changed from stale to open
- Milestone set to 2.3.4
-
Derander
+1 verified on master, this also happens w/ the string "bés"
-
Matías Flores
I've attached a patch that fixes this issue. It applies cleanly to both master and 2-3-stable.
-
John Pignata
+1 - applies cleanly to master and 2-3-stable and tests pass
-
sr.iniv.t
+1 verified.
The patch applies and all tests pass.
-
Rishav Rastogi
+1 verified.
Patch applies to master.
-
CancelProfileIsBroken
- State changed from incomplete to open
- Tag changed from activesupport, bug, bugmash, chars, multibyte, tested to activesupport, bug, bugmash, bugmash-review, chars, multibyte, tested
-
CancelProfileIsBroken
- Tag changed from activesupport, bug, bugmash, bugmash-review, chars, multibyte, tested to activesupport, bug, bugmash-review, chars, multibyte, tested
-
Manfred Stienstra
- Tag changed from activesupport, bug, bugmash-review, chars, multibyte, tested to activesupport, bug, bugmash-review, chars, multibyte, tested
Matías' fix looks good, it has my blessing (;
In a pure theoretical sense this is the correct way of fixing the problem. This makes sure that elaborate Hangul strings get reversed properly as well. It is a bit slow though. I don't know of many real world cases where you would reverse a string, so I guess if you're doing it you probably have a great incentive to do it properly and you wouldn't mind the speed penalty.
-
Repository
- State changed from open to committed
(from [4ae03b2d5a7b81a8b8d330c12de40f970525a67a]) Fix chars.reverse for multibyte decomposed strings
[#597 "bös".chars.reverse is "s̈ob" for decomposed string state:committed]
Signed-off-by: Jeremy Kemper jeremy@bitsweat.net
http://github.com/rails/rails/commit/4ae03b2d5a7b81a8b8d330c12de40f... -
Repository
(from [23780850237876cf81038534d8f59fa307af0b31]) Fix chars.reverse for multibyte decomposed strings
[#597 "bös".chars.reverse is "s̈ob" for decomposed string state:committed]
Signed-off-by: Jeremy Kemper jeremy@bitsweat.net
http://github.com/rails/rails/commit/23780850237876cf81038534d8f59f... -
Rizwan Reza
- Tag changed from activesupport, bug, bugmash-review, chars, multibyte, tested to activesupport, bug, chars, multibyte, tested
