ruby-core@ruby-lang.org archive (unofficial mirror)
 help / color / mirror / Atom feed
* [ruby-core:52215] [ruby-trunk - Bug #7845][Open] Strip doesn't handle unicode space characters in ruby 1.9.2 & 1.9.3 (does in 1.9.1)
@ 2013-02-13 15:28 timothyg56 (Timothy Garnett)
  2013-02-17  5:13 ` [ruby-core:52328] [ruby-trunk - Bug #7845] Strip doesn't " ko1 (Koichi Sasada)
                   ` (14 more replies)
  0 siblings, 15 replies; 18+ messages in thread
From: timothyg56 (Timothy Garnett) @ 2013-02-13 15:28 UTC (permalink / raw
  To: ruby-core


Issue #7845 has been reported by timothyg56 (Timothy Garnett).

----------------------------------------
Bug #7845: Strip doesn't handle unicode space characters in ruby 1.9.2 & 1.9.3 (does in 1.9.1)
https://bugs.ruby-lang.org/issues/7845

Author: timothyg56 (Timothy Garnett)
Status: Open
Priority: Normal
Assignee: 
Category: 
Target version: 
ruby -v: ruby 1.9.3p286 (2012-10-12 revision 37165) [x86_64-linux]


Strip and associated methods in ruby 1.9.2 and 1.9.3 do not remove leading/trailing unicode space characters (such as non-breaking space \u00A0 and ideographic space \u3000) unlike ruby 1.9.1.  I'd expect the 1.9.1 behavior.  Looking at the underlying native lstrip! and rstrip! methods it looks like this is because 1.9.1 uses rb_enc_isspace() whereas 1.9.2+ uses rb_isspace().

1.9.1p378 :001 > "\u3000\u00a0".strip
 => "" 

1.9.2p320 :001 > "\u3000\u00a0".strip
 => "  "

1.9.3p286 :001 > "\u3000\u00a0".strip
 => "  "


-- 
http://bugs.ruby-lang.org/

^ permalink raw reply	[flat|nested] 18+ messages in thread

* [ruby-core:52328] [ruby-trunk - Bug #7845] Strip doesn't handle unicode space characters in ruby 1.9.2 & 1.9.3 (does in 1.9.1)
  2013-02-13 15:28 [ruby-core:52215] [ruby-trunk - Bug #7845][Open] Strip doesn't handle unicode space characters in ruby 1.9.2 & 1.9.3 (does in 1.9.1) timothyg56 (Timothy Garnett)
@ 2013-02-17  5:13 ` ko1 (Koichi Sasada)
  2013-02-17 15:28 ` [ruby-core:52388] [ruby-trunk - Bug #7845][Rejected] Strip doesn't " naruse (Yui NARUSE)
                   ` (13 subsequent siblings)
  14 siblings, 0 replies; 18+ messages in thread
From: ko1 (Koichi Sasada) @ 2013-02-17  5:13 UTC (permalink / raw
  To: ruby-core


Issue #7845 has been updated by ko1 (Koichi Sasada).

Subject changed from Strip doesn't handle unicode space characters in ruby 1.9.2 & 1.9.3 (does in 1.9.1) to Strip doesn't handle unicode space characters in ruby 1.9.2 & 1.9.3 (does in 1.9.1)
Category set to M17N
Assignee set to naruse (Yui NARUSE)


----------------------------------------
Bug #7845: Strip doesn't handle unicode space characters in ruby 1.9.2 & 1.9.3 (does in 1.9.1)
https://bugs.ruby-lang.org/issues/7845#change-36371

Author: timothyg56 (Timothy Garnett)
Status: Open
Priority: Normal
Assignee: naruse (Yui NARUSE)
Category: M17N
Target version: 
ruby -v: ruby 1.9.3p286 (2012-10-12 revision 37165) [x86_64-linux]


Strip and associated methods in ruby 1.9.2 and 1.9.3 do not remove leading/trailing unicode space characters (such as non-breaking space \u00A0 and ideographic space \u3000) unlike ruby 1.9.1.  I'd expect the 1.9.1 behavior.  Looking at the underlying native lstrip! and rstrip! methods it looks like this is because 1.9.1 uses rb_enc_isspace() whereas 1.9.2+ uses rb_isspace().

1.9.1p378 :001 > "\u3000\u00a0".strip
 => "" 

1.9.2p320 :001 > "\u3000\u00a0".strip
 => "  "

1.9.3p286 :001 > "\u3000\u00a0".strip
 => "  "


-- 
http://bugs.ruby-lang.org/

^ permalink raw reply	[flat|nested] 18+ messages in thread

* [ruby-core:52388] [ruby-trunk - Bug #7845][Rejected] Strip doesn't handle unicode space characters in ruby 1.9.2 & 1.9.3 (does in 1.9.1)
  2013-02-13 15:28 [ruby-core:52215] [ruby-trunk - Bug #7845][Open] Strip doesn't handle unicode space characters in ruby 1.9.2 & 1.9.3 (does in 1.9.1) timothyg56 (Timothy Garnett)
  2013-02-17  5:13 ` [ruby-core:52328] [ruby-trunk - Bug #7845] Strip doesn't " ko1 (Koichi Sasada)
@ 2013-02-17 15:28 ` naruse (Yui NARUSE)
  2013-02-25 20:12 ` [ruby-core:52892] [ruby-trunk - Bug #7845] " timothyg56 (Timothy Garnett)
                   ` (12 subsequent siblings)
  14 siblings, 0 replies; 18+ messages in thread
From: naruse (Yui NARUSE) @ 2013-02-17 15:28 UTC (permalink / raw
  To: ruby-core


Issue #7845 has been updated by naruse (Yui NARUSE).

Subject changed from Strip doesn't handle unicode space characters in ruby 1.9.2 & 1.9.3 (does in 1.9.1) to Strip doesn't handle unicode space characters in ruby 1.9.2 & 1.9.3 (does in 1.9.1)
Status changed from Open to Rejected

The behavior is intended.
see also http://blade.nagaokaut.ac.jp/cgi-bin/scat.rb/ruby/ruby-core/19379
----------------------------------------
Bug #7845: Strip doesn't handle unicode space characters in ruby 1.9.2 & 1.9.3 (does in 1.9.1)
https://bugs.ruby-lang.org/issues/7845#change-36444

Author: timothyg56 (Timothy Garnett)
Status: Rejected
Priority: Normal
Assignee: naruse (Yui NARUSE)
Category: M17N
Target version: 
ruby -v: ruby 1.9.3p286 (2012-10-12 revision 37165) [x86_64-linux]


Strip and associated methods in ruby 1.9.2 and 1.9.3 do not remove leading/trailing unicode space characters (such as non-breaking space \u00A0 and ideographic space \u3000) unlike ruby 1.9.1.  I'd expect the 1.9.1 behavior.  Looking at the underlying native lstrip! and rstrip! methods it looks like this is because 1.9.1 uses rb_enc_isspace() whereas 1.9.2+ uses rb_isspace().

1.9.1p378 :001 > "\u3000\u00a0".strip
 => "" 

1.9.2p320 :001 > "\u3000\u00a0".strip
 => "  "

1.9.3p286 :001 > "\u3000\u00a0".strip
 => "  "


-- 
http://bugs.ruby-lang.org/

^ permalink raw reply	[flat|nested] 18+ messages in thread

* [ruby-core:52892] [ruby-trunk - Bug #7845] Strip doesn't handle unicode space characters in ruby 1.9.2 & 1.9.3 (does in 1.9.1)
  2013-02-13 15:28 [ruby-core:52215] [ruby-trunk - Bug #7845][Open] Strip doesn't handle unicode space characters in ruby 1.9.2 & 1.9.3 (does in 1.9.1) timothyg56 (Timothy Garnett)
  2013-02-17  5:13 ` [ruby-core:52328] [ruby-trunk - Bug #7845] Strip doesn't " ko1 (Koichi Sasada)
  2013-02-17 15:28 ` [ruby-core:52388] [ruby-trunk - Bug #7845][Rejected] Strip doesn't " naruse (Yui NARUSE)
@ 2013-02-25 20:12 ` timothyg56 (Timothy Garnett)
  2013-02-28 17:41 ` [ruby-core:53042] " abscond (James Darling)
                   ` (11 subsequent siblings)
  14 siblings, 0 replies; 18+ messages in thread
From: timothyg56 (Timothy Garnett) @ 2013-02-25 20:12 UTC (permalink / raw
  To: ruby-core


Issue #7845 has been updated by timothyg56 (Timothy Garnett).


I'm not sure how convincing the linked conversation is.  It seems to be about case sensitivity issues in varying locales particularly around identifiers, but whether a unicode space is a whitespace or not is not locale dependent as far as I know.  It seems like strip, which is just whitespace, could easily be encoding aware while upcase/downcase and the like were ascii only for the cited complexity reasons.

It would be nice if strip removed the equivalent of [[:space:]] as it used to, but I guess that's what open source is for.  If anyone stumbling upon this wants to patch ruby itself to restore the old behavior see https://gist.github.com/tgarnett/5032660 for ruby source or you can monkey patch in a fix to string

class String
  def lstrip
    sub(/^[[:space:]]+/, '')
  end
  def rstrip
    sub(/[[:space:]]+$/, '')
  end
  def strip
    lstrip.rstrip
  end
  # etc. for ! versions
end


----------------------------------------
Bug #7845: Strip doesn't handle unicode space characters in ruby 1.9.2 & 1.9.3 (does in 1.9.1)
https://bugs.ruby-lang.org/issues/7845#change-37004

Author: timothyg56 (Timothy Garnett)
Status: Rejected
Priority: Normal
Assignee: naruse (Yui NARUSE)
Category: M17N
Target version: 
ruby -v: ruby 1.9.3p286 (2012-10-12 revision 37165) [x86_64-linux]


Strip and associated methods in ruby 1.9.2 and 1.9.3 do not remove leading/trailing unicode space characters (such as non-breaking space \u00A0 and ideographic space \u3000) unlike ruby 1.9.1.  I'd expect the 1.9.1 behavior.  Looking at the underlying native lstrip! and rstrip! methods it looks like this is because 1.9.1 uses rb_enc_isspace() whereas 1.9.2+ uses rb_isspace().

1.9.1p378 :001 > "\u3000\u00a0".strip
 => "" 

1.9.2p320 :001 > "\u3000\u00a0".strip
 => "  "

1.9.3p286 :001 > "\u3000\u00a0".strip
 => "  "


-- 
http://bugs.ruby-lang.org/

^ permalink raw reply	[flat|nested] 18+ messages in thread

* [ruby-core:53042] [ruby-trunk - Bug #7845] Strip doesn't handle unicode space characters in ruby 1.9.2 & 1.9.3 (does in 1.9.1)
  2013-02-13 15:28 [ruby-core:52215] [ruby-trunk - Bug #7845][Open] Strip doesn't handle unicode space characters in ruby 1.9.2 & 1.9.3 (does in 1.9.1) timothyg56 (Timothy Garnett)
                   ` (2 preceding siblings ...)
  2013-02-25 20:12 ` [ruby-core:52892] [ruby-trunk - Bug #7845] " timothyg56 (Timothy Garnett)
@ 2013-02-28 17:41 ` abscond (James Darling)
  2013-03-13 14:57 ` [ruby-core:53374] " threedaymonk (Paul Battley)
                   ` (10 subsequent siblings)
  14 siblings, 0 replies; 18+ messages in thread
From: abscond (James Darling) @ 2013-02-28 17:41 UTC (permalink / raw
  To: ruby-core


Issue #7845 has been updated by abscond (James Darling).


I'm not sure I understand the rationale behind rejecting this issue based on locale issues. I'm in support of this ticket, and will try and grab someone who can respond to naruse's concerns.
----------------------------------------
Bug #7845: Strip doesn't handle unicode space characters in ruby 1.9.2 & 1.9.3 (does in 1.9.1)
https://bugs.ruby-lang.org/issues/7845#change-37195

Author: timothyg56 (Timothy Garnett)
Status: Rejected
Priority: Normal
Assignee: naruse (Yui NARUSE)
Category: M17N
Target version: 
ruby -v: ruby 1.9.3p286 (2012-10-12 revision 37165) [x86_64-linux]


Strip and associated methods in ruby 1.9.2 and 1.9.3 do not remove leading/trailing unicode space characters (such as non-breaking space \u00A0 and ideographic space \u3000) unlike ruby 1.9.1.  I'd expect the 1.9.1 behavior.  Looking at the underlying native lstrip! and rstrip! methods it looks like this is because 1.9.1 uses rb_enc_isspace() whereas 1.9.2+ uses rb_isspace().

1.9.1p378 :001 > "\u3000\u00a0".strip
 => "" 

1.9.2p320 :001 > "\u3000\u00a0".strip
 => "  "

1.9.3p286 :001 > "\u3000\u00a0".strip
 => "  "


-- 
http://bugs.ruby-lang.org/

^ permalink raw reply	[flat|nested] 18+ messages in thread

* [ruby-core:53374] [ruby-trunk - Bug #7845] Strip doesn't handle unicode space characters in ruby 1.9.2 & 1.9.3 (does in 1.9.1)
  2013-02-13 15:28 [ruby-core:52215] [ruby-trunk - Bug #7845][Open] Strip doesn't handle unicode space characters in ruby 1.9.2 & 1.9.3 (does in 1.9.1) timothyg56 (Timothy Garnett)
                   ` (3 preceding siblings ...)
  2013-02-28 17:41 ` [ruby-core:53042] " abscond (James Darling)
@ 2013-03-13 14:57 ` threedaymonk (Paul Battley)
  2013-03-13 15:11 ` [ruby-core:53375] [ruby-trunk - Bug #7845][Open] " marcandre (Marc-Andre Lafortune)
                   ` (9 subsequent siblings)
  14 siblings, 0 replies; 18+ messages in thread
From: threedaymonk (Paul Battley) @ 2013-03-13 14:57 UTC (permalink / raw
  To: ruby-core


Issue #7845 has been updated by threedaymonk (Paul Battley).


It's true that whitespace *can* be locale-dependent, at least insofar as Unix locales can specify which codepoints are to be considered as whitespace (in addition to space, tab, etc.).

The linked conversation about capitalisation doesn't seem relevant, though. The problem with capitalisation is that it really is language-specific: uppercase i is not I in Turkish, for example. Space, on the other hand isn't; it's just that the inventory of spaces used and their encoding depends on the locale: you won't find a double-width space in English, and the representation in UTF-8 and EUC-JP is different.

However, given that String#upcase/downcase are basically useless for non-ASCII content, I'm not sure I'd expect strip to handle Unicode spaces either.
----------------------------------------
Bug #7845: Strip doesn't handle unicode space characters in ruby 1.9.2 & 1.9.3 (does in 1.9.1)
https://bugs.ruby-lang.org/issues/7845#change-37573

Author: timothyg56 (Timothy Garnett)
Status: Rejected
Priority: Normal
Assignee: naruse (Yui NARUSE)
Category: M17N
Target version: 
ruby -v: ruby 1.9.3p286 (2012-10-12 revision 37165) [x86_64-linux]


Strip and associated methods in ruby 1.9.2 and 1.9.3 do not remove leading/trailing unicode space characters (such as non-breaking space \u00A0 and ideographic space \u3000) unlike ruby 1.9.1.  I'd expect the 1.9.1 behavior.  Looking at the underlying native lstrip! and rstrip! methods it looks like this is because 1.9.1 uses rb_enc_isspace() whereas 1.9.2+ uses rb_isspace().

1.9.1p378 :001 > "\u3000\u00a0".strip
 => "" 

1.9.2p320 :001 > "\u3000\u00a0".strip
 => "  "

1.9.3p286 :001 > "\u3000\u00a0".strip
 => "  "


-- 
http://bugs.ruby-lang.org/

^ permalink raw reply	[flat|nested] 18+ messages in thread

* [ruby-core:53375] [ruby-trunk - Bug #7845][Open] Strip doesn't handle unicode space characters in ruby 1.9.2 & 1.9.3 (does in 1.9.1)
  2013-02-13 15:28 [ruby-core:52215] [ruby-trunk - Bug #7845][Open] Strip doesn't handle unicode space characters in ruby 1.9.2 & 1.9.3 (does in 1.9.1) timothyg56 (Timothy Garnett)
                   ` (4 preceding siblings ...)
  2013-03-13 14:57 ` [ruby-core:53374] " threedaymonk (Paul Battley)
@ 2013-03-13 15:11 ` marcandre (Marc-Andre Lafortune)
  2013-05-04 16:50 ` [ruby-core:54783] [ruby-trunk - Bug #7845] " timothyg56 (Timothy Garnett)
                   ` (8 subsequent siblings)
  14 siblings, 0 replies; 18+ messages in thread
From: marcandre (Marc-Andre Lafortune) @ 2013-03-13 15:11 UTC (permalink / raw
  To: ruby-core


Issue #7845 has been updated by marcandre (Marc-Andre Lafortune).

Status changed from Rejected to Open
Target version set to current: 2.1.0

Let's reopen this issue.

Yui: could you explain why strip wouldn't remove leading and trailing /\p{space}/ ? I can only see upside to this, but maybe you can point out downside?
----------------------------------------
Bug #7845: Strip doesn't handle unicode space characters in ruby 1.9.2 & 1.9.3 (does in 1.9.1)
https://bugs.ruby-lang.org/issues/7845#change-37574

Author: timothyg56 (Timothy Garnett)
Status: Open
Priority: Normal
Assignee: naruse (Yui NARUSE)
Category: M17N
Target version: current: 2.1.0
ruby -v: ruby 1.9.3p286 (2012-10-12 revision 37165) [x86_64-linux]


Strip and associated methods in ruby 1.9.2 and 1.9.3 do not remove leading/trailing unicode space characters (such as non-breaking space \u00A0 and ideographic space \u3000) unlike ruby 1.9.1.  I'd expect the 1.9.1 behavior.  Looking at the underlying native lstrip! and rstrip! methods it looks like this is because 1.9.1 uses rb_enc_isspace() whereas 1.9.2+ uses rb_isspace().

1.9.1p378 :001 > "\u3000\u00a0".strip
 => "" 

1.9.2p320 :001 > "\u3000\u00a0".strip
 => "  "

1.9.3p286 :001 > "\u3000\u00a0".strip
 => "  "


-- 
http://bugs.ruby-lang.org/

^ permalink raw reply	[flat|nested] 18+ messages in thread

* [ruby-core:54783] [ruby-trunk - Bug #7845] Strip doesn't handle unicode space characters in ruby 1.9.2 & 1.9.3 (does in 1.9.1)
  2013-02-13 15:28 [ruby-core:52215] [ruby-trunk - Bug #7845][Open] Strip doesn't handle unicode space characters in ruby 1.9.2 & 1.9.3 (does in 1.9.1) timothyg56 (Timothy Garnett)
                   ` (5 preceding siblings ...)
  2013-03-13 15:11 ` [ruby-core:53375] [ruby-trunk - Bug #7845][Open] " marcandre (Marc-Andre Lafortune)
@ 2013-05-04 16:50 ` timothyg56 (Timothy Garnett)
  2013-05-04 17:03 ` [ruby-core:54785] [ruby-trunk - Bug #7845][Rejected] " naruse (Yui NARUSE)
                   ` (7 subsequent siblings)
  14 siblings, 0 replies; 18+ messages in thread
From: timothyg56 (Timothy Garnett) @ 2013-05-04 16:50 UTC (permalink / raw
  To: ruby-core


Issue #7845 has been updated by timothyg56 (Timothy Garnett).


A patch for this is pretty straightforward, see https://gist.github.com/tgarnett/5032660 which is only a couple of lines.

As someone dealing with a lot of web crawling and chinese source data, having strip remove non-breaking / ideographic spaces is a real boon (particularly given the large amount of code we have originally written to 1.9.1).
----------------------------------------
Bug #7845: Strip doesn't handle unicode space characters in ruby 1.9.2 & 1.9.3 (does in 1.9.1)
https://bugs.ruby-lang.org/issues/7845#change-39126

Author: timothyg56 (Timothy Garnett)
Status: Open
Priority: Normal
Assignee: naruse (Yui NARUSE)
Category: M17N
Target version: current: 2.1.0
ruby -v: ruby 1.9.3p286 (2012-10-12 revision 37165) [x86_64-linux]
Backport: 


Strip and associated methods in ruby 1.9.2 and 1.9.3 do not remove leading/trailing unicode space characters (such as non-breaking space \u00A0 and ideographic space \u3000) unlike ruby 1.9.1.  I'd expect the 1.9.1 behavior.  Looking at the underlying native lstrip! and rstrip! methods it looks like this is because 1.9.1 uses rb_enc_isspace() whereas 1.9.2+ uses rb_isspace().

1.9.1p378 :001 > "\u3000\u00a0".strip
 => "" 

1.9.2p320 :001 > "\u3000\u00a0".strip
 => "  "

1.9.3p286 :001 > "\u3000\u00a0".strip
 => "  "


-- 
http://bugs.ruby-lang.org/

^ permalink raw reply	[flat|nested] 18+ messages in thread

* [ruby-core:54785] [ruby-trunk - Bug #7845][Rejected] Strip doesn't handle unicode space characters in ruby 1.9.2 & 1.9.3 (does in 1.9.1)
  2013-02-13 15:28 [ruby-core:52215] [ruby-trunk - Bug #7845][Open] Strip doesn't handle unicode space characters in ruby 1.9.2 & 1.9.3 (does in 1.9.1) timothyg56 (Timothy Garnett)
                   ` (6 preceding siblings ...)
  2013-05-04 16:50 ` [ruby-core:54783] [ruby-trunk - Bug #7845] " timothyg56 (Timothy Garnett)
@ 2013-05-04 17:03 ` naruse (Yui NARUSE)
  2013-05-06  5:28 ` [ruby-core:54814] [ruby-trunk - Bug #7845][Open] " marcandre (Marc-Andre Lafortune)
                   ` (6 subsequent siblings)
  14 siblings, 0 replies; 18+ messages in thread
From: naruse (Yui NARUSE) @ 2013-05-04 17:03 UTC (permalink / raw
  To: ruby-core


Issue #7845 has been updated by naruse (Yui NARUSE).

Status changed from Open to Rejected

marcandre (Marc-Andre Lafortune) wrote:
> Let's reopen this issue.
> 
> Yui: could you explain why strip wouldn't remove leading and trailing /\p{space}/ ? I can only see upside to this, but maybe you can point out downside?

Did you read [ruby-core:19379]?
----------------------------------------
Bug #7845: Strip doesn't handle unicode space characters in ruby 1.9.2 & 1.9.3 (does in 1.9.1)
https://bugs.ruby-lang.org/issues/7845#change-39127

Author: timothyg56 (Timothy Garnett)
Status: Rejected
Priority: Normal
Assignee: naruse (Yui NARUSE)
Category: M17N
Target version: current: 2.1.0
ruby -v: ruby 1.9.3p286 (2012-10-12 revision 37165) [x86_64-linux]
Backport: 


Strip and associated methods in ruby 1.9.2 and 1.9.3 do not remove leading/trailing unicode space characters (such as non-breaking space \u00A0 and ideographic space \u3000) unlike ruby 1.9.1.  I'd expect the 1.9.1 behavior.  Looking at the underlying native lstrip! and rstrip! methods it looks like this is because 1.9.1 uses rb_enc_isspace() whereas 1.9.2+ uses rb_isspace().

1.9.1p378 :001 > "\u3000\u00a0".strip
 => "" 

1.9.2p320 :001 > "\u3000\u00a0".strip
 => "  "

1.9.3p286 :001 > "\u3000\u00a0".strip
 => "  "


-- 
http://bugs.ruby-lang.org/

^ permalink raw reply	[flat|nested] 18+ messages in thread

* [ruby-core:54814] [ruby-trunk - Bug #7845][Open] Strip doesn't handle unicode space characters in ruby 1.9.2 & 1.9.3 (does in 1.9.1)
  2013-02-13 15:28 [ruby-core:52215] [ruby-trunk - Bug #7845][Open] Strip doesn't handle unicode space characters in ruby 1.9.2 & 1.9.3 (does in 1.9.1) timothyg56 (Timothy Garnett)
                   ` (7 preceding siblings ...)
  2013-05-04 17:03 ` [ruby-core:54785] [ruby-trunk - Bug #7845][Rejected] " naruse (Yui NARUSE)
@ 2013-05-06  5:28 ` marcandre (Marc-Andre Lafortune)
  2013-05-06  8:58 ` [ruby-core:54819] [ruby-trunk - Bug #7845] " matz (Yukihiro Matsumoto)
                   ` (5 subsequent siblings)
  14 siblings, 0 replies; 18+ messages in thread
From: marcandre (Marc-Andre Lafortune) @ 2013-05-06  5:28 UTC (permalink / raw
  To: ruby-core


Issue #7845 has been updated by marcandre (Marc-Andre Lafortune).

Status changed from Rejected to Open
Assignee deleted (naruse (Yui NARUSE))

naruse (Yui NARUSE) wrote:
> Did you read [ruby-core:19379]?

I did. 

Out of respect, I will assume that you read [ruby-core:53374] which explains nicely that [ruby-core:19379] has absolutely nothing to do with what constitutes a space and how `strip` should behave.

It would have been appreciated if instead of repeating your reference (which some of us believe not to be relevant) you would explain why you still feel it is of any relevance. This would be the helpful and polite thing to do.

I would also appreciate if you answered my questions too. For your convenience:

> Yui: could you explain why strip wouldn't remove leading and trailing /\p{space}/ ? I can only see upside to this, but maybe you can point out downside?

Finally, could you please tell me why you rejected again this issue? Maybe if some people disagree with you, including a fellow committer, maybe the right thing to do is to explain yourself and ask Matz for his decision instead, would you not agree?
----------------------------------------
Bug #7845: Strip doesn't handle unicode space characters in ruby 1.9.2 & 1.9.3 (does in 1.9.1)
https://bugs.ruby-lang.org/issues/7845#change-39154

Author: timothyg56 (Timothy Garnett)
Status: Open
Priority: Normal
Assignee: 
Category: M17N
Target version: current: 2.1.0
ruby -v: ruby 1.9.3p286 (2012-10-12 revision 37165) [x86_64-linux]
Backport: 


Strip and associated methods in ruby 1.9.2 and 1.9.3 do not remove leading/trailing unicode space characters (such as non-breaking space \u00A0 and ideographic space \u3000) unlike ruby 1.9.1.  I'd expect the 1.9.1 behavior.  Looking at the underlying native lstrip! and rstrip! methods it looks like this is because 1.9.1 uses rb_enc_isspace() whereas 1.9.2+ uses rb_isspace().

1.9.1p378 :001 > "\u3000\u00a0".strip
 => "" 

1.9.2p320 :001 > "\u3000\u00a0".strip
 => "  "

1.9.3p286 :001 > "\u3000\u00a0".strip
 => "  "


-- 
http://bugs.ruby-lang.org/

^ permalink raw reply	[flat|nested] 18+ messages in thread

* [ruby-core:54819] [ruby-trunk - Bug #7845] Strip doesn't handle unicode space characters in ruby 1.9.2 & 1.9.3 (does in 1.9.1)
  2013-02-13 15:28 [ruby-core:52215] [ruby-trunk - Bug #7845][Open] Strip doesn't handle unicode space characters in ruby 1.9.2 & 1.9.3 (does in 1.9.1) timothyg56 (Timothy Garnett)
                   ` (8 preceding siblings ...)
  2013-05-06  5:28 ` [ruby-core:54814] [ruby-trunk - Bug #7845][Open] " marcandre (Marc-Andre Lafortune)
@ 2013-05-06  8:58 ` matz (Yukihiro Matsumoto)
  2013-05-06 12:25 ` [ruby-core:54823] [CommonRuby - Feature " naruse (Yui NARUSE)
                   ` (4 subsequent siblings)
  14 siblings, 0 replies; 18+ messages in thread
From: matz (Yukihiro Matsumoto) @ 2013-05-06  8:58 UTC (permalink / raw
  To: ruby-core


Issue #7845 has been updated by matz (Yukihiro Matsumoto).


Five yeas have passed since the decision in [ruby-core:19379], and Unicode had almost taken over the world.
Maybe it's time to relax the limitation at least when we are using Unicode.

Matz.

----------------------------------------
Bug #7845: Strip doesn't handle unicode space characters in ruby 1.9.2 & 1.9.3 (does in 1.9.1)
https://bugs.ruby-lang.org/issues/7845#change-39157

Author: timothyg56 (Timothy Garnett)
Status: Open
Priority: Normal
Assignee: 
Category: M17N
Target version: current: 2.1.0
ruby -v: ruby 1.9.3p286 (2012-10-12 revision 37165) [x86_64-linux]
Backport: 


Strip and associated methods in ruby 1.9.2 and 1.9.3 do not remove leading/trailing unicode space characters (such as non-breaking space \u00A0 and ideographic space \u3000) unlike ruby 1.9.1.  I'd expect the 1.9.1 behavior.  Looking at the underlying native lstrip! and rstrip! methods it looks like this is because 1.9.1 uses rb_enc_isspace() whereas 1.9.2+ uses rb_isspace().

1.9.1p378 :001 > "\u3000\u00a0".strip
 => "" 

1.9.2p320 :001 > "\u3000\u00a0".strip
 => "  "

1.9.3p286 :001 > "\u3000\u00a0".strip
 => "  "


-- 
http://bugs.ruby-lang.org/

^ permalink raw reply	[flat|nested] 18+ messages in thread

* [ruby-core:54823] [CommonRuby - Feature #7845] Strip doesn't handle unicode space characters in ruby 1.9.2 & 1.9.3 (does in 1.9.1)
  2013-02-13 15:28 [ruby-core:52215] [ruby-trunk - Bug #7845][Open] Strip doesn't handle unicode space characters in ruby 1.9.2 & 1.9.3 (does in 1.9.1) timothyg56 (Timothy Garnett)
                   ` (9 preceding siblings ...)
  2013-05-06  8:58 ` [ruby-core:54819] [ruby-trunk - Bug #7845] " matz (Yukihiro Matsumoto)
@ 2013-05-06 12:25 ` naruse (Yui NARUSE)
  2013-05-06 12:52 ` [ruby-core:54825] " matz (Yukihiro Matsumoto)
                   ` (3 subsequent siblings)
  14 siblings, 0 replies; 18+ messages in thread
From: naruse (Yui NARUSE) @ 2013-05-06 12:25 UTC (permalink / raw
  To: ruby-core


Issue #7845 has been updated by naruse (Yui NARUSE).


Current string-related policy is ASCII-based.
If it is changed, how wide it is applied is the issue; for example
* strip
* split
* upcase/downcase
----------------------------------------
Feature #7845: Strip doesn't handle unicode space characters in ruby 1.9.2 & 1.9.3 (does in 1.9.1)
https://bugs.ruby-lang.org/issues/7845#change-39161

Author: timothyg56 (Timothy Garnett)
Status: Open
Priority: Normal
Assignee: 
Category: 
Target version: 


Strip and associated methods in ruby 1.9.2 and 1.9.3 do not remove leading/trailing unicode space characters (such as non-breaking space \u00A0 and ideographic space \u3000) unlike ruby 1.9.1.  I'd expect the 1.9.1 behavior.  Looking at the underlying native lstrip! and rstrip! methods it looks like this is because 1.9.1 uses rb_enc_isspace() whereas 1.9.2+ uses rb_isspace().

1.9.1p378 :001 > "\u3000\u00a0".strip
 => "" 

1.9.2p320 :001 > "\u3000\u00a0".strip
 => "  "

1.9.3p286 :001 > "\u3000\u00a0".strip
 => "  "


-- 
http://bugs.ruby-lang.org/

^ permalink raw reply	[flat|nested] 18+ messages in thread

* [ruby-core:54825] [CommonRuby - Feature #7845] Strip doesn't handle unicode space characters in ruby 1.9.2 & 1.9.3 (does in 1.9.1)
  2013-02-13 15:28 [ruby-core:52215] [ruby-trunk - Bug #7845][Open] Strip doesn't handle unicode space characters in ruby 1.9.2 & 1.9.3 (does in 1.9.1) timothyg56 (Timothy Garnett)
                   ` (10 preceding siblings ...)
  2013-05-06 12:25 ` [ruby-core:54823] [CommonRuby - Feature " naruse (Yui NARUSE)
@ 2013-05-06 12:52 ` matz (Yukihiro Matsumoto)
  2013-05-06 13:46   ` [ruby-core:54830] " Tanaka Akira
  2013-05-06 16:12 ` [ruby-core:54832] " matz (Yukihiro Matsumoto)
                   ` (2 subsequent siblings)
  14 siblings, 1 reply; 18+ messages in thread
From: matz (Yukihiro Matsumoto) @ 2013-05-06 12:52 UTC (permalink / raw
  To: ruby-core


Issue #7845 has been updated by matz (Yukihiro Matsumoto).


Everything that can be resolved without locale/language information (for most of the cases).
Case conversion may have problems with some characters, e.g. german eszett or turkish i, but can be converted mostly.
Of course it would take time to implement everything, but the basic principle (and goal) will be.

Matz.

----------------------------------------
Feature #7845: Strip doesn't handle unicode space characters in ruby 1.9.2 & 1.9.3 (does in 1.9.1)
https://bugs.ruby-lang.org/issues/7845#change-39163

Author: timothyg56 (Timothy Garnett)
Status: Open
Priority: Normal
Assignee: 
Category: 
Target version: 


Strip and associated methods in ruby 1.9.2 and 1.9.3 do not remove leading/trailing unicode space characters (such as non-breaking space \u00A0 and ideographic space \u3000) unlike ruby 1.9.1.  I'd expect the 1.9.1 behavior.  Looking at the underlying native lstrip! and rstrip! methods it looks like this is because 1.9.1 uses rb_enc_isspace() whereas 1.9.2+ uses rb_isspace().

1.9.1p378 :001 > "\u3000\u00a0".strip
 => "" 

1.9.2p320 :001 > "\u3000\u00a0".strip
 => "  "

1.9.3p286 :001 > "\u3000\u00a0".strip
 => "  "


-- 
http://bugs.ruby-lang.org/

^ permalink raw reply	[flat|nested] 18+ messages in thread

* [ruby-core:54830] Re: [CommonRuby - Feature #7845] Strip doesn't handle unicode space characters in ruby 1.9.2 & 1.9.3 (does in 1.9.1)
  2013-05-06 12:52 ` [ruby-core:54825] " matz (Yukihiro Matsumoto)
@ 2013-05-06 13:46   ` Tanaka Akira
  0 siblings, 0 replies; 18+ messages in thread
From: Tanaka Akira @ 2013-05-06 13:46 UTC (permalink / raw
  To: ruby-core

2013/5/6 matz (Yukihiro Matsumoto) <matz@ruby-lang.org>:
>
> Everything that can be resolved without locale/language information (for most of the cases).
> Case conversion may have problems with some characters, e.g. german eszett or turkish i, but can be converted mostly.
> Of course it would take time to implement everything, but the basic principle (and goal) will be.

Be careful about network libraries.

Text based network protocol itself is not Unicode based in general.
If a primitive used in a such library is extended to Unicode, it may
cause mismatch to the protocol.

For example, the result of "grep -r strip lib/net" should be examined to
strip is used properly or not.
-- 
Tanaka Akira

^ permalink raw reply	[flat|nested] 18+ messages in thread

* [ruby-core:54832] [CommonRuby - Feature #7845] Strip doesn't handle unicode space characters in ruby 1.9.2 & 1.9.3 (does in 1.9.1)
  2013-02-13 15:28 [ruby-core:52215] [ruby-trunk - Bug #7845][Open] Strip doesn't handle unicode space characters in ruby 1.9.2 & 1.9.3 (does in 1.9.1) timothyg56 (Timothy Garnett)
                   ` (11 preceding siblings ...)
  2013-05-06 12:52 ` [ruby-core:54825] " matz (Yukihiro Matsumoto)
@ 2013-05-06 16:12 ` matz (Yukihiro Matsumoto)
  2013-05-07  6:08   ` [ruby-core:54843] " Tanaka Akira
  2013-05-06 16:59 ` [ruby-core:54833] " naruse (Yui NARUSE)
  2013-05-07  1:03 ` [ruby-core:54839] " matz (Yukihiro Matsumoto)
  14 siblings, 1 reply; 18+ messages in thread
From: matz (Yukihiro Matsumoto) @ 2013-05-06 16:12 UTC (permalink / raw
  To: ruby-core


Issue #7845 has been updated by matz (Yukihiro Matsumoto).


Akira, Thank you for pointing out.

But it's hard for me to imagine concrete problematic cases.
When text from network connection is marked as Unicode, that's OK to process them as Unicode text,
otherwise they should be marked as 'ASCII-8BIT' so that #strip and other methods should behave as
they are now.

Matz.

----------------------------------------
Feature #7845: Strip doesn't handle unicode space characters in ruby 1.9.2 & 1.9.3 (does in 1.9.1)
https://bugs.ruby-lang.org/issues/7845#change-39168

Author: timothyg56 (Timothy Garnett)
Status: Open
Priority: Normal
Assignee: 
Category: 
Target version: 


Strip and associated methods in ruby 1.9.2 and 1.9.3 do not remove leading/trailing unicode space characters (such as non-breaking space \u00A0 and ideographic space \u3000) unlike ruby 1.9.1.  I'd expect the 1.9.1 behavior.  Looking at the underlying native lstrip! and rstrip! methods it looks like this is because 1.9.1 uses rb_enc_isspace() whereas 1.9.2+ uses rb_isspace().

1.9.1p378 :001 > "\u3000\u00a0".strip
 => "" 

1.9.2p320 :001 > "\u3000\u00a0".strip
 => "  "

1.9.3p286 :001 > "\u3000\u00a0".strip
 => "  "


-- 
http://bugs.ruby-lang.org/

^ permalink raw reply	[flat|nested] 18+ messages in thread

* [ruby-core:54833] [CommonRuby - Feature #7845] Strip doesn't handle unicode space characters in ruby 1.9.2 & 1.9.3 (does in 1.9.1)
  2013-02-13 15:28 [ruby-core:52215] [ruby-trunk - Bug #7845][Open] Strip doesn't handle unicode space characters in ruby 1.9.2 & 1.9.3 (does in 1.9.1) timothyg56 (Timothy Garnett)
                   ` (12 preceding siblings ...)
  2013-05-06 16:12 ` [ruby-core:54832] " matz (Yukihiro Matsumoto)
@ 2013-05-06 16:59 ` naruse (Yui NARUSE)
  2013-05-07  1:03 ` [ruby-core:54839] " matz (Yukihiro Matsumoto)
  14 siblings, 0 replies; 18+ messages in thread
From: naruse (Yui NARUSE) @ 2013-05-06 16:59 UTC (permalink / raw
  To: ruby-core


Issue #7845 has been updated by naruse (Yui NARUSE).


matz (Yukihiro Matsumoto) wrote:
> Akira, Thank you for pointing out.
> 
> But it's hard for me to imagine concrete problematic cases.
> When text from network connection is marked as Unicode, that's OK to process them as Unicode text,
> otherwise they should be marked as 'ASCII-8BIT' so that #strip and other methods should behave as
> they are now.
> 
> Matz.

Modern protocol like SMTPUTF8 <http://tools.ietf.org/html/rfc6532> and URL Standard <http://url.spec.whatwg.org/>
use UTF-8 as its character encoding, but they use ASCII whitespace.
----------------------------------------
Feature #7845: Strip doesn't handle unicode space characters in ruby 1.9.2 & 1.9.3 (does in 1.9.1)
https://bugs.ruby-lang.org/issues/7845#change-39169

Author: timothyg56 (Timothy Garnett)
Status: Open
Priority: Normal
Assignee: 
Category: 
Target version: 


Strip and associated methods in ruby 1.9.2 and 1.9.3 do not remove leading/trailing unicode space characters (such as non-breaking space \u00A0 and ideographic space \u3000) unlike ruby 1.9.1.  I'd expect the 1.9.1 behavior.  Looking at the underlying native lstrip! and rstrip! methods it looks like this is because 1.9.1 uses rb_enc_isspace() whereas 1.9.2+ uses rb_isspace().

1.9.1p378 :001 > "\u3000\u00a0".strip
 => "" 

1.9.2p320 :001 > "\u3000\u00a0".strip
 => "  "

1.9.3p286 :001 > "\u3000\u00a0".strip
 => "  "


-- 
http://bugs.ruby-lang.org/

^ permalink raw reply	[flat|nested] 18+ messages in thread

* [ruby-core:54839] [CommonRuby - Feature #7845] Strip doesn't handle unicode space characters in ruby 1.9.2 & 1.9.3 (does in 1.9.1)
  2013-02-13 15:28 [ruby-core:52215] [ruby-trunk - Bug #7845][Open] Strip doesn't handle unicode space characters in ruby 1.9.2 & 1.9.3 (does in 1.9.1) timothyg56 (Timothy Garnett)
                   ` (13 preceding siblings ...)
  2013-05-06 16:59 ` [ruby-core:54833] " naruse (Yui NARUSE)
@ 2013-05-07  1:03 ` matz (Yukihiro Matsumoto)
  14 siblings, 0 replies; 18+ messages in thread
From: matz (Yukihiro Matsumoto) @ 2013-05-07  1:03 UTC (permalink / raw
  To: ruby-core


Issue #7845 has been updated by matz (Yukihiro Matsumoto).


=begin
Thank you for valuable input.

That indicates the need for something like (({str.strip(:ascii)})), or opposite (({str.strip(:utf8)}))

Matz.
=end
----------------------------------------
Feature #7845: Strip doesn't handle unicode space characters in ruby 1.9.2 & 1.9.3 (does in 1.9.1)
https://bugs.ruby-lang.org/issues/7845#change-39172

Author: timothyg56 (Timothy Garnett)
Status: Open
Priority: Normal
Assignee: 
Category: 
Target version: 


Strip and associated methods in ruby 1.9.2 and 1.9.3 do not remove leading/trailing unicode space characters (such as non-breaking space \u00A0 and ideographic space \u3000) unlike ruby 1.9.1.  I'd expect the 1.9.1 behavior.  Looking at the underlying native lstrip! and rstrip! methods it looks like this is because 1.9.1 uses rb_enc_isspace() whereas 1.9.2+ uses rb_isspace().

1.9.1p378 :001 > "\u3000\u00a0".strip
 => "" 

1.9.2p320 :001 > "\u3000\u00a0".strip
 => "  "

1.9.3p286 :001 > "\u3000\u00a0".strip
 => "  "


-- 
http://bugs.ruby-lang.org/

^ permalink raw reply	[flat|nested] 18+ messages in thread

* [ruby-core:54843] Re: [CommonRuby - Feature #7845] Strip doesn't handle unicode space characters in ruby 1.9.2 & 1.9.3 (does in 1.9.1)
  2013-05-06 16:12 ` [ruby-core:54832] " matz (Yukihiro Matsumoto)
@ 2013-05-07  6:08   ` Tanaka Akira
  0 siblings, 0 replies; 18+ messages in thread
From: Tanaka Akira @ 2013-05-07  6:08 UTC (permalink / raw
  To: ruby-core

2013/5/7 matz (Yukihiro Matsumoto) <matz@ruby-lang.org>:
>
> But it's hard for me to imagine concrete problematic cases.
> When text from network connection is marked as Unicode, that's OK to process them as Unicode text,
> otherwise they should be marked as 'ASCII-8BIT' so that #strip and other methods should behave as
> they are now.

I see.  It seems less harmful than I expected.

However the encoding of a string can be easily changed if it contains
ASCII character only.

% ruby -e 'p(("a".force_encoding("UTF-8") +
"b".force_encoding("ASCII-8BIT")).encoding)'
#<Encoding:UTF-8>

So I think your sentence is bit weak to preserve current network libraries.
Appropriate restriction is "bahavior of methods for ASCII only strings
shold behave as the are now regardless of its encoding (ASCII-8BIT, UTF-8,
etc)".

(I assume the ASCII based network protocols, not Unicode based such as
naruse-san pointed.)

The famous example of such dangerous Unicode behavior is turkish case
conversion but it is locale dependent and you already said locale dependent
behavior is not target of this change.

I'm not sure that there are no such (locale-independent but affects ASCII
only string) Unicode behaviors, though.
Any experts here?
-- 
Tanaka Akira

^ permalink raw reply	[flat|nested] 18+ messages in thread

end of thread, other threads:[~2013-05-07  6:32 UTC | newest]

Thread overview: 18+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-02-13 15:28 [ruby-core:52215] [ruby-trunk - Bug #7845][Open] Strip doesn't handle unicode space characters in ruby 1.9.2 & 1.9.3 (does in 1.9.1) timothyg56 (Timothy Garnett)
2013-02-17  5:13 ` [ruby-core:52328] [ruby-trunk - Bug #7845] Strip doesn&#x27;t " ko1 (Koichi Sasada)
2013-02-17 15:28 ` [ruby-core:52388] [ruby-trunk - Bug #7845][Rejected] Strip doesn't " naruse (Yui NARUSE)
2013-02-25 20:12 ` [ruby-core:52892] [ruby-trunk - Bug #7845] " timothyg56 (Timothy Garnett)
2013-02-28 17:41 ` [ruby-core:53042] " abscond (James Darling)
2013-03-13 14:57 ` [ruby-core:53374] " threedaymonk (Paul Battley)
2013-03-13 15:11 ` [ruby-core:53375] [ruby-trunk - Bug #7845][Open] " marcandre (Marc-Andre Lafortune)
2013-05-04 16:50 ` [ruby-core:54783] [ruby-trunk - Bug #7845] " timothyg56 (Timothy Garnett)
2013-05-04 17:03 ` [ruby-core:54785] [ruby-trunk - Bug #7845][Rejected] " naruse (Yui NARUSE)
2013-05-06  5:28 ` [ruby-core:54814] [ruby-trunk - Bug #7845][Open] " marcandre (Marc-Andre Lafortune)
2013-05-06  8:58 ` [ruby-core:54819] [ruby-trunk - Bug #7845] " matz (Yukihiro Matsumoto)
2013-05-06 12:25 ` [ruby-core:54823] [CommonRuby - Feature " naruse (Yui NARUSE)
2013-05-06 12:52 ` [ruby-core:54825] " matz (Yukihiro Matsumoto)
2013-05-06 13:46   ` [ruby-core:54830] " Tanaka Akira
2013-05-06 16:12 ` [ruby-core:54832] " matz (Yukihiro Matsumoto)
2013-05-07  6:08   ` [ruby-core:54843] " Tanaka Akira
2013-05-06 16:59 ` [ruby-core:54833] " naruse (Yui NARUSE)
2013-05-07  1:03 ` [ruby-core:54839] " matz (Yukihiro Matsumoto)

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).