ruby-changes:62775
From: Nobuyoshi <ko1@a...>
Date: Mon, 31 Aug 2020 21:58:19 +0900 (JST)
Subject: [ruby-changes:62775] c76508b88c (master): [ruby/strscan] Replaced examples using $KCODE with encodings
https://git.ruby-lang.org/ruby.git/commit/?id=c76508b88c From c76508b88c083c29aaafaec7d67072b45f7e40aa Mon Sep 17 00:00:00 2001 From: Nobuyoshi Nakada <nobu@r...> Date: Mon, 31 Aug 2020 21:47:25 +0900 Subject: [ruby/strscan] Replaced examples using $KCODE with encodings `$KCODE` has been deprecated and not effective since years ago. https://github.com/ruby/strscan/commit/7c4dbd4cb3 diff --git a/ext/strscan/strscan.c b/ext/strscan/strscan.c index a484a47..2294d92 100644 --- a/ext/strscan/strscan.c +++ b/ext/strscan/strscan.c @@ -848,9 +848,8 @@ adjust_registers_to_matched(struct strscanner *p) https://github.com/ruby/ruby/blob/trunk/ext/strscan/strscan.c#L848 * s.getch # => "b" * s.getch # => nil * - * $KCODE = 'EUC' - * s = StringScanner.new("\244\242") - * s.getch # => "\244\242" # Japanese hira-kana "A" in EUC-JP + * s = StringScanner.new("\244\242".force_encoding("euc-jp")) + * s.getch # => "\x{A4A2}" # Japanese hira-kana "A" in EUC-JP * s.getch # => nil */ static VALUE @@ -885,10 +884,9 @@ strscan_getch(VALUE self) https://github.com/ruby/ruby/blob/trunk/ext/strscan/strscan.c#L884 * s.get_byte # => "b" * s.get_byte # => nil * - * $KCODE = 'EUC' - * s = StringScanner.new("\244\242") - * s.get_byte # => "\244" - * s.get_byte # => "\242" + * s = StringScanner.new("\244\242".force_encoding("euc-jp")) + * s.get_byte # => "\xA4" + * s.get_byte # => "\xA2" * s.get_byte # => nil */ static VALUE -- cgit v0.10.2 -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/