Skip to content

Commit

Permalink
Replaced examples using $KCODE with encodings
Browse files Browse the repository at this point in the history
`$KCODE` has been deprecated and not effective since years ago.
  • Loading branch information
nobu committed Aug 31, 2020
1 parent 6f5158c commit 7c4dbd4
Showing 1 changed file with 5 additions and 7 deletions.
12 changes: 5 additions & 7 deletions ext/strscan/strscan.c
Expand Up @@ -848,9 +848,8 @@ adjust_registers_to_matched(struct strscanner *p)
* 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
Expand Down Expand Up @@ -885,10 +884,9 @@ strscan_getch(VALUE self)
* 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
Expand Down

0 comments on commit 7c4dbd4

Please sign in to comment.