1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

[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
This commit is contained in:
Nobuyoshi Nakada 2020-08-31 21:47:25 +09:00
parent 01f28405b1
commit c76508b88c
No known key found for this signature in database
GPG key ID: 7CD2805BFA3770C6

View file

@ -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
@ -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