ruby-dev (Japanese) list archive (unofficial mirror)
 help / color / mirror / Atom feed
* [ruby-dev:50269] [Ruby trunk Bug#13955] NKF.nkf のオプション文字列が SHARABLE_MIDDLE_SUBSTRING=1 を考慮していない
       [not found] <redmine.issue-13955.20170930080126@ruby-lang.org>
@ 2017-09-30  8:01 ` tommy
  2017-12-24 20:07 ` [ruby-dev:50387] " nagachika00
  2018-01-31 13:39 ` [ruby-dev:50458] " usa
  2 siblings, 0 replies; 3+ messages in thread
From: tommy @ 2017-09-30  8:01 UTC (permalink / raw)
  To: ruby-dev

Issue #13955 has been reported by tommy (Masahiro Tomita).

----------------------------------------
Bug #13955: NKF.nkf のオプション文字列が SHARABLE_MIDDLE_SUBSTRING=1 を考慮していない
https://bugs.ruby-lang.org/issues/13955

* Author: tommy (Masahiro Tomita)
* Status: Open
* Priority: Normal
* Assignee: 
* Target version: 
* ruby -v: 
* Backport: 2.3: UNKNOWN, 2.4: UNKNOWN
----------------------------------------
SHARABLE_MIDDLE_SUBSTRING=1 でコンパイルしたRubyで、NKF.nkf のオプション文字列が正しく扱われません。

```
% ruby -rnkf -e 'opt="--ic=UTF-8 --oc=EUC-JISX0213 -w"[0,28]; p opt; p NKF.nkf(opt, "あ").encoding'
"--ic=UTF-8 --oc=EUC-JISX0213"
#<Encoding:UTF-8>
```

次のパッチで直ると思います。

```diff
diff --git a/ext/nkf/nkf.c b/ext/nkf/nkf.c
index 9613a925ce..df32e9cf0b 100644
--- a/ext/nkf/nkf.c
+++ b/ext/nkf/nkf.c
@@ -137,7 +137,7 @@ rb_nkf_convert(VALUE obj, VALUE opt, VALUE src)
 {
     VALUE tmp;
     reinit();
-    StringValue(opt);
+    StringValueCStr(opt);
     nkf_split_options(RSTRING_PTR(opt));
     if (!output_encoding) rb_raise(rb_eArgError, "no output encoding given");
 
```

適用後

```
% ruby -rnkf -e 'opt="--ic=UTF-8 --oc=EUC-JISX0213 -w"[0,28]; p opt; p NKF.nkf(opt, "あ").encoding'
"--ic=UTF-8 --oc=EUC-JISX0213"
#<Encoding:EUC-JIS-2004>
```



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

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

* [ruby-dev:50387] [Ruby trunk Bug#13955] NKF.nkf のオプション文字列が SHARABLE_MIDDLE_SUBSTRING=1 を考慮していない
       [not found] <redmine.issue-13955.20170930080126@ruby-lang.org>
  2017-09-30  8:01 ` [ruby-dev:50269] [Ruby trunk Bug#13955] NKF.nkf のオプション文字列が SHARABLE_MIDDLE_SUBSTRING=1 を考慮していない tommy
@ 2017-12-24 20:07 ` nagachika00
  2018-01-31 13:39 ` [ruby-dev:50458] " usa
  2 siblings, 0 replies; 3+ messages in thread
From: nagachika00 @ 2017-12-24 20:07 UTC (permalink / raw)
  To: ruby-dev

Issue #13955 has been updated by nagachika (Tomoyuki Chikanaga).

Backport changed from 2.3: REQUIRED, 2.4: REQUIRED to 2.3: REQUIRED, 2.4: DONE

ruby_2_4 r61456 merged revision(s) 60071.

----------------------------------------
Bug #13955: NKF.nkf のオプション文字列が SHARABLE_MIDDLE_SUBSTRING=1 を考慮していない
https://bugs.ruby-lang.org/issues/13955#change-68631

* Author: tommy (Masahiro Tomita)
* Status: Closed
* Priority: Normal
* Assignee: 
* Target version: 
* ruby -v: 
* Backport: 2.3: REQUIRED, 2.4: DONE
----------------------------------------
SHARABLE_MIDDLE_SUBSTRING=1 でコンパイルしたRubyで、NKF.nkf のオプション文字列が正しく扱われません。

```
% ruby -rnkf -e 'opt="--ic=UTF-8 --oc=EUC-JISX0213 -w"[0,28]; p opt; p NKF.nkf(opt, "あ").encoding'
"--ic=UTF-8 --oc=EUC-JISX0213"
#<Encoding:UTF-8>
```

次のパッチで直ると思います。

```diff
diff --git a/ext/nkf/nkf.c b/ext/nkf/nkf.c
index 9613a925ce..df32e9cf0b 100644
--- a/ext/nkf/nkf.c
+++ b/ext/nkf/nkf.c
@@ -137,7 +137,7 @@ rb_nkf_convert(VALUE obj, VALUE opt, VALUE src)
 {
     VALUE tmp;
     reinit();
-    StringValue(opt);
+    StringValueCStr(opt);
     nkf_split_options(RSTRING_PTR(opt));
     if (!output_encoding) rb_raise(rb_eArgError, "no output encoding given");
 
```

適用後

```
% ruby -rnkf -e 'opt="--ic=UTF-8 --oc=EUC-JISX0213 -w"[0,28]; p opt; p NKF.nkf(opt, "あ").encoding'
"--ic=UTF-8 --oc=EUC-JISX0213"
#<Encoding:EUC-JIS-2004>
```



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

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

* [ruby-dev:50458] [Ruby trunk Bug#13955] NKF.nkf のオプション文字列が SHARABLE_MIDDLE_SUBSTRING=1 を考慮していない
       [not found] <redmine.issue-13955.20170930080126@ruby-lang.org>
  2017-09-30  8:01 ` [ruby-dev:50269] [Ruby trunk Bug#13955] NKF.nkf のオプション文字列が SHARABLE_MIDDLE_SUBSTRING=1 を考慮していない tommy
  2017-12-24 20:07 ` [ruby-dev:50387] " nagachika00
@ 2018-01-31 13:39 ` usa
  2 siblings, 0 replies; 3+ messages in thread
From: usa @ 2018-01-31 13:39 UTC (permalink / raw)
  To: ruby-dev

Issue #13955 has been updated by usa (Usaku NAKAMURA).

Backport changed from 2.3: REQUIRED, 2.4: DONE to 2.3: DONE, 2.4: DONE

ruby_2_3 r62140 merged revision(s) 60071.

----------------------------------------
Bug #13955: NKF.nkf のオプション文字列が SHARABLE_MIDDLE_SUBSTRING=1 を考慮していない
https://bugs.ruby-lang.org/issues/13955#change-70087

* Author: tommy (Masahiro Tomita)
* Status: Closed
* Priority: Normal
* Assignee: 
* Target version: 
* ruby -v: 
* Backport: 2.3: DONE, 2.4: DONE
----------------------------------------
SHARABLE_MIDDLE_SUBSTRING=1 でコンパイルしたRubyで、NKF.nkf のオプション文字列が正しく扱われません。

```
% ruby -rnkf -e 'opt="--ic=UTF-8 --oc=EUC-JISX0213 -w"[0,28]; p opt; p NKF.nkf(opt, "あ").encoding'
"--ic=UTF-8 --oc=EUC-JISX0213"
#<Encoding:UTF-8>
```

次のパッチで直ると思います。

```diff
diff --git a/ext/nkf/nkf.c b/ext/nkf/nkf.c
index 9613a925ce..df32e9cf0b 100644
--- a/ext/nkf/nkf.c
+++ b/ext/nkf/nkf.c
@@ -137,7 +137,7 @@ rb_nkf_convert(VALUE obj, VALUE opt, VALUE src)
 {
     VALUE tmp;
     reinit();
-    StringValue(opt);
+    StringValueCStr(opt);
     nkf_split_options(RSTRING_PTR(opt));
     if (!output_encoding) rb_raise(rb_eArgError, "no output encoding given");
 
```

適用後

```
% ruby -rnkf -e 'opt="--ic=UTF-8 --oc=EUC-JISX0213 -w"[0,28]; p opt; p NKF.nkf(opt, "あ").encoding'
"--ic=UTF-8 --oc=EUC-JISX0213"
#<Encoding:EUC-JIS-2004>
```



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

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

end of thread, other threads:[~2018-01-31 13:39 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <redmine.issue-13955.20170930080126@ruby-lang.org>
2017-09-30  8:01 ` [ruby-dev:50269] [Ruby trunk Bug#13955] NKF.nkf のオプション文字列が SHARABLE_MIDDLE_SUBSTRING=1 を考慮していない tommy
2017-12-24 20:07 ` [ruby-dev:50387] " nagachika00
2018-01-31 13:39 ` [ruby-dev:50458] " 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).