ruby-dev (Japanese) list archive (unofficial mirror)
 help / color / mirror / Atom feed
* [ruby-dev:48442] [ruby-trunk - Bug #10078] [Open] String#count() returns wrong count under specific conditions
       [not found] <redmine.issue-10078.20140721161034@ruby-lang.org>
@ 2014-07-21 16:10 ` h.najima
  2014-07-22  3:56 ` [ruby-dev:48443] [ruby-trunk - Bug #10078] [Closed] " nobu
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 5+ messages in thread
From: h.najima @ 2014-07-21 16:10 UTC (permalink / raw
  To: ruby-dev

Issue #10078 has been reported by Hiroki Najima.

----------------------------------------
Bug #10078: String#count() returns wrong count under specific conditions
https://bugs.ruby-lang.org/issues/10078

* Author: Hiroki Najima
* Status: Open
* Priority: Normal
* Assignee: 
* Category: 
* Target version: 
* ruby -v: ruby 2.0.0p481 (2014-05-08) [i386-mingw32]
* Backport: 2.0.0: UNKNOWN, 2.1: UNKNOWN
----------------------------------------
以下の条件の場合、String#countが誤った文字数を返します。

* 文字コードがWindows-31J (文字コード体系が違うせいか、UTF_8, ISO2022_JP, EUC_JPでは再現せず)
* countの引数が1バイト文字一つのみ
* Stringにcountに指定された文字と一致する文字コードが含まれる。

異常な例: 和は0x9861, aは0x61

~~~
>ruby -ve "puts 'a-和'.count('a')"
ruby 2.0.0p481 (2014-05-08) [i386-mingw32]
2
~~~

正常な例: countに2バイト以上与えると動作が正しくなります。
'a-a'などtr由来のcountの動作も的確ですが、'a-a'と'a'は等価なはずなのに異常な例と結果が異なります。

~~~
>ruby -ve "puts 'a-和'.count('a-a')"
ruby 2.0.0p481 (2014-05-08) [i386-mingw32]
1

>ruby -ve "puts 'a-和'.count('ab')"
ruby 2.0.0p481 (2014-05-08) [i386-mingw32]
1
~~~




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

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

* [ruby-dev:48443] [ruby-trunk - Bug #10078] [Closed] String#count() returns wrong count under specific conditions
       [not found] <redmine.issue-10078.20140721161034@ruby-lang.org>
  2014-07-21 16:10 ` [ruby-dev:48442] [ruby-trunk - Bug #10078] [Open] String#count() returns wrong count under specific conditions h.najima
@ 2014-07-22  3:56 ` nobu
  2014-07-22 12:45 ` [ruby-dev:48444] [ruby-trunk - Bug #10078] " nagachika00
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 5+ messages in thread
From: nobu @ 2014-07-22  3:56 UTC (permalink / raw
  To: ruby-dev

Issue #10078 has been updated by Nobuyoshi Nakada.

Status changed from Open to Closed
% Done changed from 0 to 100

Applied in changeset r46896.

----------
string.c: fix wrong single-byte optimization

* string.c (rb_str_count): fix wrong single-byte optimization.
  7bit ascii can be a trailing byte in Shift_JIS.
  [ruby-dev:48442] [Bug #10078]

----------------------------------------
Bug #10078: String#count() returns wrong count under specific conditions
https://bugs.ruby-lang.org/issues/10078#change-47952

* Author: Hiroki Najima
* Status: Closed
* Priority: Normal
* Assignee: 
* Category: 
* Target version: 
* ruby -v: ruby 2.0.0p481 (2014-05-08) [i386-mingw32]
* Backport: 2.0.0: UNKNOWN, 2.1: UNKNOWN
----------------------------------------
以下の条件の場合、String#countが誤った文字数を返します。

* 文字コードがWindows-31J (文字コード体系が違うせいか、UTF_8, ISO2022_JP, EUC_JPでは再現せず)
* countの引数が1バイト文字一つのみ
* Stringにcountに指定された文字と一致する文字コードが含まれる。

異常な例: 和は0x9861, aは0x61

~~~
>ruby -ve "puts 'a-和'.count('a')"
ruby 2.0.0p481 (2014-05-08) [i386-mingw32]
2
~~~

正常な例: countに2バイト以上与えると動作が正しくなります。
'a-a'などtr由来のcountの動作も的確ですが、'a-a'と'a'は等価なはずなのに異常な例と結果が異なります。

~~~
>ruby -ve "puts 'a-和'.count('a-a')"
ruby 2.0.0p481 (2014-05-08) [i386-mingw32]
1

>ruby -ve "puts 'a-和'.count('ab')"
ruby 2.0.0p481 (2014-05-08) [i386-mingw32]
1
~~~




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

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

* [ruby-dev:48444] [ruby-trunk - Bug #10078] String#count() returns wrong count under specific conditions
       [not found] <redmine.issue-10078.20140721161034@ruby-lang.org>
  2014-07-21 16:10 ` [ruby-dev:48442] [ruby-trunk - Bug #10078] [Open] String#count() returns wrong count under specific conditions h.najima
  2014-07-22  3:56 ` [ruby-dev:48443] [ruby-trunk - Bug #10078] [Closed] " nobu
@ 2014-07-22 12:45 ` nagachika00
  2014-08-22 17:38 ` [ruby-dev:48486] " nagachika00
  2014-09-05  4:50 ` [ruby-dev:48523] " usa
  4 siblings, 0 replies; 5+ messages in thread
From: nagachika00 @ 2014-07-22 12:45 UTC (permalink / raw
  To: ruby-dev

Issue #10078 has been updated by Tomoyuki Chikanaga.

Backport changed from 2.0.0: UNKNOWN, 2.1: UNKNOWN to 2.0.0: REQUIRED, 2.1: REQUIRED

----------------------------------------
Bug #10078: String#count() returns wrong count under specific conditions
https://bugs.ruby-lang.org/issues/10078#change-47956

* Author: Hiroki Najima
* Status: Closed
* Priority: Normal
* Assignee: 
* Category: 
* Target version: 
* ruby -v: ruby 2.0.0p481 (2014-05-08) [i386-mingw32]
* Backport: 2.0.0: REQUIRED, 2.1: REQUIRED
----------------------------------------
以下の条件の場合、String#countが誤った文字数を返します。

* 文字コードがWindows-31J (文字コード体系が違うせいか、UTF_8, ISO2022_JP, EUC_JPでは再現せず)
* countの引数が1バイト文字一つのみ
* Stringにcountに指定された文字と一致する文字コードが含まれる。

異常な例: 和は0x9861, aは0x61

~~~
>ruby -ve "puts 'a-和'.count('a')"
ruby 2.0.0p481 (2014-05-08) [i386-mingw32]
2
~~~

正常な例: countに2バイト以上与えると動作が正しくなります。
'a-a'などtr由来のcountの動作も的確ですが、'a-a'と'a'は等価なはずなのに異常な例と結果が異なります。

~~~
>ruby -ve "puts 'a-和'.count('a-a')"
ruby 2.0.0p481 (2014-05-08) [i386-mingw32]
1

>ruby -ve "puts 'a-和'.count('ab')"
ruby 2.0.0p481 (2014-05-08) [i386-mingw32]
1
~~~




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

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

* [ruby-dev:48486] [ruby-trunk - Bug #10078] String#count() returns wrong count under specific conditions
       [not found] <redmine.issue-10078.20140721161034@ruby-lang.org>
                   ` (2 preceding siblings ...)
  2014-07-22 12:45 ` [ruby-dev:48444] [ruby-trunk - Bug #10078] " nagachika00
@ 2014-08-22 17:38 ` nagachika00
  2014-09-05  4:50 ` [ruby-dev:48523] " usa
  4 siblings, 0 replies; 5+ messages in thread
From: nagachika00 @ 2014-08-22 17:38 UTC (permalink / raw
  To: ruby-dev

Issue #10078 has been updated by Tomoyuki Chikanaga.

Backport changed from 2.0.0: REQUIRED, 2.1: REQUIRED to 2.0.0: REQUIRED, 2.1: DONE

Backported into `ruby_2_1` branch at r47255.

----------------------------------------
Bug #10078: String#count() returns wrong count under specific conditions
https://bugs.ruby-lang.org/issues/10078#change-48445

* Author: Hiroki Najima
* Status: Closed
* Priority: Normal
* Assignee: 
* Category: 
* Target version: 
* ruby -v: ruby 2.0.0p481 (2014-05-08) [i386-mingw32]
* Backport: 2.0.0: REQUIRED, 2.1: DONE
----------------------------------------
以下の条件の場合、String#countが誤った文字数を返します。

* 文字コードがWindows-31J (文字コード体系が違うせいか、UTF_8, ISO2022_JP, EUC_JPでは再現せず)
* countの引数が1バイト文字一つのみ
* Stringにcountに指定された文字と一致する文字コードが含まれる。

異常な例: 和は0x9861, aは0x61

~~~
>ruby -ve "puts 'a-和'.count('a')"
ruby 2.0.0p481 (2014-05-08) [i386-mingw32]
2
~~~

正常な例: countに2バイト以上与えると動作が正しくなります。
'a-a'などtr由来のcountの動作も的確ですが、'a-a'と'a'は等価なはずなのに異常な例と結果が異なります。

~~~
>ruby -ve "puts 'a-和'.count('a-a')"
ruby 2.0.0p481 (2014-05-08) [i386-mingw32]
1

>ruby -ve "puts 'a-和'.count('ab')"
ruby 2.0.0p481 (2014-05-08) [i386-mingw32]
1
~~~




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

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

* [ruby-dev:48523] [ruby-trunk - Bug #10078] String#count() returns wrong count under specific conditions
       [not found] <redmine.issue-10078.20140721161034@ruby-lang.org>
                   ` (3 preceding siblings ...)
  2014-08-22 17:38 ` [ruby-dev:48486] " nagachika00
@ 2014-09-05  4:50 ` usa
  4 siblings, 0 replies; 5+ messages in thread
From: usa @ 2014-09-05  4:50 UTC (permalink / raw
  To: ruby-dev

Issue #10078 has been updated by Usaku NAKAMURA.

Backport changed from 2.0.0: REQUIRED, 2.1: DONE to 2.0.0: DONE, 2.1: DONE

backported into `ruby_2_0_0` at r47401.

----------------------------------------
Bug #10078: String#count() returns wrong count under specific conditions
https://bugs.ruby-lang.org/issues/10078#change-48668

* Author: Hiroki Najima
* Status: Closed
* Priority: Normal
* Assignee: 
* Category: 
* Target version: 
* ruby -v: ruby 2.0.0p481 (2014-05-08) [i386-mingw32]
* Backport: 2.0.0: DONE, 2.1: DONE
----------------------------------------
以下の条件の場合、String#countが誤った文字数を返します。

* 文字コードがWindows-31J (文字コード体系が違うせいか、UTF_8, ISO2022_JP, EUC_JPでは再現せず)
* countの引数が1バイト文字一つのみ
* Stringにcountに指定された文字と一致する文字コードが含まれる。

異常な例: 和は0x9861, aは0x61

~~~
>ruby -ve "puts 'a-和'.count('a')"
ruby 2.0.0p481 (2014-05-08) [i386-mingw32]
2
~~~

正常な例: countに2バイト以上与えると動作が正しくなります。
'a-a'などtr由来のcountの動作も的確ですが、'a-a'と'a'は等価なはずなのに異常な例と結果が異なります。

~~~
>ruby -ve "puts 'a-和'.count('a-a')"
ruby 2.0.0p481 (2014-05-08) [i386-mingw32]
1

>ruby -ve "puts 'a-和'.count('ab')"
ruby 2.0.0p481 (2014-05-08) [i386-mingw32]
1
~~~




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

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

end of thread, other threads:[~2014-09-05  5:11 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <redmine.issue-10078.20140721161034@ruby-lang.org>
2014-07-21 16:10 ` [ruby-dev:48442] [ruby-trunk - Bug #10078] [Open] String#count() returns wrong count under specific conditions h.najima
2014-07-22  3:56 ` [ruby-dev:48443] [ruby-trunk - Bug #10078] [Closed] " nobu
2014-07-22 12:45 ` [ruby-dev:48444] [ruby-trunk - Bug #10078] " nagachika00
2014-08-22 17:38 ` [ruby-dev:48486] " nagachika00
2014-09-05  4:50 ` [ruby-dev:48523] " usa

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).